https://github.com/afeiship/json-server-multiple
Multiple apis support for json server.
https://github.com/afeiship/json-server-multiple
api json json-server mock server
Last synced: about 1 month ago
JSON representation
Multiple apis support for json server.
- Host: GitHub
- URL: https://github.com/afeiship/json-server-multiple
- Owner: afeiship
- License: mit
- Created: 2017-04-27T14:14:27.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-09-01T11:23:47.000Z (almost 6 years ago)
- Last Synced: 2025-10-02T18:22:54.006Z (9 months ago)
- Topics: api, json, json-server, mock, server
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# json-server-multiple
> Multiple apis support for json server.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]
## installation
```bash
npm i -S @feizheng/json-server-multiple
```
## usage
```javascript
// config.js
import path from 'path';
export const MOUNT_POINT = '/api/v1/';
export const DB_JSON = path.join(__dirname, './database/db.json');
export const STRINGIFY_INDENT = 2;
export const APIS = path.join(__dirname, './apis');
// app.js
import JsonServer from 'json-server';
import JsonServerMultiple from 'json-server-multiple';
import {
MOUNT_POINT,
DB_JSON,
APIS
} from './config';
// create multiple apis
JsonServerMultiple.create(DB_JSON, APIS);
const server = JsonServer.create();
const router = JsonServer.router(DB_JSON);
const middlewares = JsonServer.defaults();
server.use(middlewares);
server.use(router);
server.use(MOUNT_POINT, router);
server.listen(3001, () => {
console.log('JSON Server is running')
});
```
## resouces
- https://github.com/Marak/faker.js
## license
Code released under [the MIT license](https://github.com/afeiship/json-server-multiple/blob/master/LICENSE.txt).
[version-image]: https://img.shields.io/npm/v/@feizheng/json-server-multiple
[version-url]: https://npmjs.org/package/@feizheng/json-server-multiple
[license-image]: https://img.shields.io/npm/l/@feizheng/json-server-multiple
[license-url]: https://github.com/afeiship/json-server-multiple/blob/master/LICENSE.txt
[size-image]: https://img.shields.io/bundlephobia/minzip/@feizheng/json-server-multiple
[size-url]: https://github.com/afeiship/json-server-multiple/blob/master/dist/json-server-multiple.min.js
[download-image]: https://img.shields.io/npm/dm/@feizheng/json-server-multiple
[download-url]: https://www.npmjs.com/package/@feizheng/json-server-multiple