Koapi
RESTful API framework based on koa and bookshelf
Build a RESTful API with Koa
will be dead simple
Install
npm install koapi
I recommended you install a globaly version for advanced usage.
npm install -g koapi
Quick Usage
Create server.js below
import Koapi, {Router} from 'koapi';
const app = new Koapi();
const posts = new Router();
posts.get('/', function*(){
this.body = 'Hello World';
});
app.run({
port: 4000,
debug: true,
cors: true,
serve: {
root: __dirname + '/public',
},
routers: [ posts ],
});
Now run it
babel-node server.js
Advanced Usage
Create your project folder
mkdir /path/to/project
cd /path/to/project
Init a boilerplate
koapi init ./
For the boilerplate details, see koapi-boilerplate