@cc12703m/reed-json-api

1.0.3 • Public • Published

Reed Json API

KOA middleware for Json Rest API

Sample

    const app = new Koa(),
        filePath = path.join(process.cwd(), 'json-api.hbs'),
        options = { urlPrefix: '/api', filePath}

    app.use(koaBody())
    app.use(api(options))

    app.use(ctx => {
        ctx.status = 404
        ctx.body = { error: 'not found' }
    })

    return app.listen(8000)

Options

urlPrefix: Optional Set the URL path prefix

filePath: Required file path to the json template The json is generated by dummy json.

dummyOptions: Optional options when parsing dummy json. see here for more detail.

/@cc12703m/reed-json-api/

    Package Sidebar

    Install

    npm i @cc12703m/reed-json-api

    Weekly Downloads

    2

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    10.5 kB

    Total Files

    9

    Last publish

    Collaborators

    • cc12703