Nocturnal Pumpkin Maelstrom

    mockrize
    TypeScript icon, indicating that this package has built-in type declarations

    0.9.1 • Public • Published

    mockrize

    Create RESTful API mock server easily, according to directory structures of your repository.

    GitHub Action codecov Latest Stable Version

    Example

    Given you have this structure:

    .
    ├── server.js
    └── root
        ├── foo
        │   └── baa.json
        └── hello
            └── :name
                ├── index.js
                └── update.js
    

    You server.js looks like:

    const mockrize = require('mockrize');
     
    const app = await mockrize({
        rootDir: './root',
    });
     
    app.listen(4001);

    Kick node server.js, then

    % node server.js
    GET /foo/baa
    GET /hello/:name
    POST /hello/:name/update
    

    Those endpoints are automatically generated.

    Why?

    It's always paiful to make agreement between server-devs and frontend-devs on how API req/res should look like. We've had headache when we manage "sandbox" or "mock" API services WITHOUT permission control then changes make things chaotic.

    This mockrize package can provide a way to create HTTP RESTful API mock server based on the folder structure of your git repository, which means you can control write/read permission and track the change logs of your mock-API.

    TODOs and Issues

    Keywords

    none

    Install

    npm i mockrize

    DownloadsWeekly Downloads

    1

    Version

    0.9.1

    License

    MIT

    Unpacked Size

    299 kB

    Total Files

    36

    Last publish

    Collaborators

    • otiai10