actionhero
Version:
actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks
83 lines (69 loc) • 5.19 kB
HTML
<section class="bs-docs-section">
<h1 id="servers" class="page-header">Features</h1>
<h2 id="actions">Easy-To-Use Actions</h2>
<p><span class="label label-info"><a href="/docs/core/#actions">Action Docs</a></span></p>
<p>With ActionHero, you create 'actions' which can respond to any type of connection. They process incoming parameters and offer a response to the client. ActionHero takes care of routing and responding to each connection type for you.</p>
{% highlight javascript %}
exports.action = {
name: 'randomNumber',
description: 'I generate a random number',
action.inputs: {
'required' : [],
'optional' : []
},
outputExample: {randomNumber: 123}
run: function(api, data, next){
data.response.randomNumber = Math.random();
next();
}
}
{% endhighlight %}
<h2 id="tasks">Built-In Tasks</h2>
<p><span class="label label-info"><a href="/docs/core/#tasks">Task Docs</a></span></p>
<p>Background tasks are first-class citizens in ActionHero. You can enqueue a task from anywhere in the application. Tasks can be recurring or single-run. ActionHero's task system is powered by Resque, so it is compatible with a number of other applications and frameworks.</p>
{% highlight javascript %}
api.tasks.enqueue(
"sendWelcomeEmail",
{to: 'evan@evantahler.com'},
'default',
function(error, toRun){
// done!
});
var task = {
name: "sendWelcomeEmail",
description: "I will send a new user a welcome email",
queue: "default",
frequency: 0,
run: function(api, params, next){
api.sendEmail(params.email, function(error){
if(error){ api.log(error, 'error'); }
next();
})
}
};
{% endhighlight %}
<h2 id="cluster-ready">Cluster-Ready</h2>
<p><span class="label label-info"><a href="/docs/core/#action-cluster">Action Cluster Docs</a></span></p>
<p>ActionHero uses Redis to store and share data. With first-class cache functions, decentralized communications, and distributed workers, you can be sure that your application to as big of a cluster as you need.</p>
<h2 id="introduction">Multiple Servers and Transports</h2>
<p><span class="label label-info"><a href="/docs/overview/">Introduction Docs</a></span></p>
<p>The ActionHero API makes it simple to create a traditional HTTP(S) API, but it also lets you easily extend your API to TCP and websocket clients, all of which are included of course. ActionHero also easily lets you write your own servers to handle custom transports, ensuring you can connect with & federate all your existing services.</p>
<h2 id="routing">Routing</h2>
<p><span class="label label-info"><a href="/docs/servers/#web-routes">Route Docs</a></span></p>
<p>ActionHero ships with a robust router to make mapping HTTP requests to your actions a breeze. Easily wire-up your actions in RESTful patterns ensuring that your client applications can easily connect. Wildcard matching, URL-decomposition, and query extraction are all built in.</p>
<h2 id="api-first">API First Development</h2>
<p><span class="label label-info"><a href="http://api-first.com">www.api-first.com</a></span></p>
<p>ActionHero makes API-First development easy by enforcing a strict separation of views and application logic and removing barriers to API creation. Versioning your actions is simple and integrates well with Agile or XP team workflows.</p>
<h2 id="chat">Chat</h2>
<p><span class="label label-info"><a href="/docs/core/#chat">Chat Docs</a></span></p>
<p>ActionHero (optionally) facilitates real-time communication not only from server-to-client, but also client-to-client! ActionHero's chat system allows for streaming of both public and private messages between clients. Complete with middleware and extensions, you can create chat services, multi-player games, and more!</p>
<h2 id="clustered-deployment">Deployment Tools</h2>
<p><span class="label label-info"><a href="/docs/deployment/">Deployment Docs</a></span></p>
<p>It is simple to deploy ActionHero with our included CLI tools. You can launch your server as a single instance or as part of a larger deployment cluster. Tools for 0-downtime deployments and robust monitoring and logging hooks make ActionHero a dream platform for your operations team.</p>
<h2 id="file-server">File Server</h2>
<p><span class="label label-info"><a href="/docs/core/#file-server">File Server Docs</a></span></p>
<p>Every server needs to serve files to its clients (even those that don't speak HTTP), and ActionHero is no exception. Configured to asynchronously stream file contents, ActionHero provides an robust file server which can live in parallel with your API, allowing for a fully featured server.</p>
<h2 id="localization">Localization</h2>
<p><span class="label label-info"><a href="/docs/core/#localization">Localization Docs</a></span></p>
<p>ActionHero is deeply integrated with `i18n` to allow you to customize every string your clients might see. You can customize how language is determined for your API consumers, and respond to your clients in the way they are used to. This includes modular error responses and API input hints.</p>
</section>