Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    js-apipublic

    js-api

    Creates a REST API server from given JavaScript/JSON objects. Uses Koa for the REST API.

    Quickstart

    Install the package:

    npm install js-api

    Start js-api server:

    var jsapi = require('js-api');
    var data = {posts: [{id: 'p1', title: 'first post', body: 'lorem ip sum'}]};
    jsapi.start(data, 3000);

    Now browse to http://localhost:3000/posts and you will see the posts in JSON format.

    Custom Routes and Middleware

    See example.js for a complete example with custom middleware and custom route definitions for resources.

    License

    MIT

    Keywords

    none

    install

    npm i js-api

    Downloadslast 7 days

    2

    version

    1.2.0

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar