2.0.3 • Published 5 years ago

apj v2.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Apj

Start with a complete Koa server with zero configuration.

Apj includes Koa packages:

  • koa-body
  • koa-helmet
  • koa-router
  • koa-static
  • koa-views
  • koa-logger
  • koa-json-success
  • koa-struct
  • koa-incache
  • @koa/cors@2
  • koa-session

Installation

npm install apj --save

Example

const Apj = require('apj');

new Apj().start(); // Listen on http://localhost:3000

Add routes

const app = new Apj();

app.router.get('/my-route', ctx => {
    ctx.body = 'hello';
});

app.start();

Use middleware

new Apj({
    use: [
        async (ctx, next) => {
            const start = Date.now();
            await next();
            const ms = Date.now() - start;
            console.log(`${ctx.method} ${ctx.url} - ${ms}ms`);
        }
    ]
});

API

Apj

Kind: global class

new Apj(opt)

Create instance

apj.start(port) ⇒ Apj

Start server app

Kind: instance method of Apj
Emits: start

apj.stop() ⇒ Apj

Stop server app

Kind: instance method of Apj
Emits: stop

"start"

Triggered on server start

Kind: event emitted by Apj

"stop"

Triggered on server stop

Kind: event emitted by Apj

Apj~apj : object

Apj instance

Kind: inner typedef of Apj
Properties

Changelog

You can view the changelog here

License

Apj is open-sourced software licensed under the MIT license

Author

Fabio Ricali

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.0

6 years ago