actionhero
Version:
actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks
111 lines (88 loc) • 2.58 kB
Markdown
# Getting Started
## Requirements
```bash
# 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)
```
* node.js ( >= v4.0.0)
* npm
* redis (for cluster support, cache, stats, and tasks); but not required.
## Install & Quickstart
**Get Started Now:**
```bash
mkdir ~/project && cd ~/project
npm install actionhero
./node_modules/.bin/actionhero generate
npm install
npm start
```
* Create a new directory `mkdir ~/project && cd ~/project`
* Checkout the actionhero source `npm install actionhero`
* Use the generator to create a template project `./node_modules/.bin/actionhero generate`
* `npm install` to install dependencies
* You can now start up the server: `npm start`
Visit `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 start`.
## Application Structure
```bash
# 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 in `/actions` will be loaded in automatically, along `/initializers` and `/tasks`.
`/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 `api.config.general.paths` section
## Tutorial
Want to see an example application using actionhero? You can check out the code and follow the detailed guide [here (https://github.com/evantahler/actionhero-tutorial)](https://github.com/evantahler/actionhero-tutorial). This project demonstrates many of the core features of actionhero in a simple project.