json-server icon indicating copy to clipboard operation
json-server copied to clipboard

Single json-server for multiple json files ?

Open korrio opened this issue 6 years ago • 5 comments

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 ?

korrio avatar Oct 09 '19 14:10 korrio

I have the same needs

huge689 avatar Nov 05 '19 04:11 huge689

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.

lguariento avatar Nov 11 '19 16:11 lguariento

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).

lguariento avatar Nov 11 '19 19:11 lguariento

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};

demiro avatar Mar 30 '20 04:03 demiro

Me too!

gk7279 avatar Apr 26 '22 14:04 gk7279