typicode / json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)
Other
72.59k stars 7k forks source link

Single json-server for multiple json files ? #1035

Open korrio opened 4 years ago

korrio commented 4 years ago

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 ?

huge689 commented 4 years ago

I have the same needs

lguariento commented 4 years ago

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 commented 4 years ago

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

demiro commented 4 years ago

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};
gk7279 commented 2 years ago

Me too!