Json-server: Single json-server for multiple json files ?

Created on 9 Oct 2019  路  4Comments  路  Source: typicode/json-server

I have db.json and db2.json
I want to create json-server for both db in the same server with different endpoints.
How would I implement that ?

Most helpful comment

I would want to have similar feature.... I have different entities... like categories.json, suppliers.json, etc...
I would want them all in one db... could we run something like
json-server --watchDir "./mydata" where it would combine on the fly (to db.json) all json files inside a dir? or maybe allow a db.js, where I would do something like:

import * as categories from 'categories.json';
import * as suppliers from 'suppliers.json';

 const db = {categories, suppliers};

All 4 comments

I have the same needs

Hello, me too. I'd be happy to just be able to have two instances running on two different ports, serving each a different json file.

PS: I solved this quite easily. I just launched two instances serving two different files using two different ports (in two terminal sessions of course).

I would want to have similar feature.... I have different entities... like categories.json, suppliers.json, etc...
I would want them all in one db... could we run something like
json-server --watchDir "./mydata" where it would combine on the fly (to db.json) all json files inside a dir? or maybe allow a db.js, where I would do something like:

import * as categories from 'categories.json';
import * as suppliers from 'suppliers.json';

 const db = {categories, suppliers};
Was this page helpful?
0 / 5 - 0 ratings

Related issues

pantchox picture pantchox  路  3Comments

strom picture strom  路  4Comments

fishenal picture fishenal  路  3Comments

0plus1 picture 0plus1  路  3Comments

sharpmachine picture sharpmachine  路  4Comments