HTTP server for apeman.


Keywords
apeman, command, app, web
License
MIT
Install
npm install apeman-app@7.0.8

Documentation

apeman-app

Build Status Code Climate Code Coverage npm Version

HTTP server for apeman.

Overview

apeman-app create a HTTP server to serve web apps.

In Apeman file, each apps has url mapping for request handlers. These handlers have same signature with connect middleware, so you can reuse middlewares written for connect or express.

There are official app plugins supported by apeman team.

Installation

Install apeman-app module via npm.

$ npm install apeman-app -g

Usage

  1. Prepare an Apemanfile.js at your project root.
  2. Run the command via CLI.

Apemanfile.js

/** Example of Apemanfile.js */

"use strict";

module.exports = {
    $cwd: __dirname,
    $pkg: {/*...*/},
    $tmpls: {/*...*/},
    $tasks: {/*...*/},
    $apps: {
        "my-awesome-app": {
            '/': [
                require('apeman-app-static')('public')
            ],
            '/api': [
                require('apeman-app-contrib-delay')(300),
                require('apeman-app-contrib-log')({})
            ]
        }
    },
    $wtchs: {/*...*/}
};

Then,

# Start web server
$ apeman-app --port 3000
CLI Options
$ apeman-app -h

  Usage: apeman-app [options] [name] 

  Run an apeman app.

  Options:

    -h, --help                           output usage information
    -V, --version                        output the version number
    -v, --verbose                        Show verbose logs
    -p, --port <port>                    Number of port
    -s, --setup <setup>                  Server setup module.
    -o, --log <log>                      Log file path.
    -c, --configuration <configuration>  Pathname of Apemanfile

  Examples:

    $ apeman-app my-awesome-app -p 3000                    # Start an app.
    $ apeman-app                                           # List available apps.

Programmatic API

apeman-app also provide programmatic API.

Firstly, install the module locally.

$ npm install apeman-app --save-dev

Then,

"use strict";

const apemanApp = require('apeman-app');

apemanApp([
    "my-awesome-app"
], {
    port: 3500
}, function (err) {
    /*...*/
});
Programmatic Options
Key Description Default
verbose Show verbose logs
port Number of port "3000"
setup Server setup module. false
log Log file path. false
configuration Pathname of Apemanfile

Contribution

You can create your own app plugin quickly with scaffold.

Install apeman-scaffold as a global module

$ npm install apeman-scaffold -g

then, generate scaffold.

$ apeman-scaffold app apeman-app-yourown

License

This software is released under the MIT License.

Links