ActionHero is a node.js API framework for both tcp sockets, web sockets, and http clients. The goal of ActionHero is to create an easy-to-use toolkit for making reusable & scalable APIs. Clients connected to an ActionHero server can consume the API, consume static content, and communicate with each other.
ActionHero servers can process both requests and tasks (delayed actions like `send e-mail` or other background jobs). ActionHero servers can also run in a cluster (on the same or multiple machines) to work in concert to handle your load.
The ActionHero API defines a single access point and accepts GET, POST, PUT and DELETE input along with persistent connection via TCP or web sockets. You define Actions which handle input and response, such as `userAdd` or `geoLocate`. HTTP, HTTPS, and TCP clients can all use these actions. The ActionHero API is not inherently 'RESTful' (which is meaningless for persistent socket connections) but can be extended to be so if you wish.
ActionHero will also serve static files for you, but ActionHero is not a 'rendering' server (like express or rails).
> npm start > [email protected] start /app/actionhero > node ./bin/actionhero info: actionhero >> start 2015-11-14 16:01:27 - notice: *** starting actionhero *** 2015-11-14 16:01:27 - info: actionhero member 10.0.1.15 has joined the cluster 2015-11-14 16:01:27 - notice: pid: 36087 2015-11-14 16:01:27 - notice: server ID: 10.0.1.15 2015-11-14 16:01:27 - info: ensuring the existence of the chatRoom: defaultRoom 2015-11-14 16:01:27 - info: ensuring the existence of the chatRoom: anotherRoom 2015-11-14 16:01:27 - notice: starting server: web 2015-11-14 16:01:27 - notice: starting server: websocket 2015-11-14 16:01:28 - notice: environment: development 2015-11-14 16:01:28 - notice: *** Server Started @ 2015-11-14 16:01:28 ***
# On OSX With Homebrew: brew install node brew install redis # On Ubuntu: (sudo) apt-get install node (sudo) apt-get install redis-server # On Windows: [download nodeJS](https://nodejs.org/en/download) [download redis](https://github.com/MSOpenTech/redis)
Get started now:
mkdir ~/project && cd ~/project npm install actionhero ./node_modules/.bin/actionhero generate npm install npm start
mkdir ~/project && cd ~/project
npm install actionhero
npm installto install dependencies
http://127.0.0.1:8080 in your browser to see the ActionHero in action!
You can also opt to install ActionHero globally
npm install actionhero -g and then you can just call
# ActionHero Project Layout |- config | -- api.js | -- errors.js | -- i18n.js | -- logger.js | -- redis.js | -- routes.js | -- tasks.js | -- servers | ---- web.js | ---- websocket.js | ---- socket.js |-- (project settings) | |- actions |-- (your actions) | |- initializers |-- (any additional initializers you want) | |- log |-- (default location for logs) | |- node_modules |-- (your modules, ActionHero should be npm installed in here) | |- pids |-- (pidfiles for your running servers) | |- public |-- (your static assets to be served by /file) | |- servers |-- (custom servers you may make) | |- tasks |-- (your tasks) | |- locales |-- (translation files) | |- tests |-- (tests for your API) | readme.md package.json (be sure to include 'actionhero':'x')
The map to the right describes ActionHero's default project layout.
/actions will be loaded in automatically, along
/public will become your application's default static asset location.
If you wish to customize your project's paths, you can do so within
config/api.js in the
Want to see an example application using ActionHero? You can check out the code and follow the detailed guide here (https://github.com/actionhero/actionhero-tutorial). This project demonstrates many of the core features of ActionHero in a simple project.
The www.actionherojs.com website and documentation is hosted on Heroku, and built from this codebase. You can submit pull requests to the master branch with any updates or changes.
This documentation will always reflect the master branch of ActionHero, and therefore may be slightly ahead of the latest release on NPM.
The ActionHero server is open source, under the Apache-2 license
ActionHero runs on Linux, OS X, and Windows
You always have access to the ActionHero team via Slack and Github
For larger customers in need of a support contract, we offer an enterprise plan including everything in the Premium plan plus: