New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't watch multiple files #265
Comments
Hi @Jimmy5nomana, The description may not be very clear. You can watch So you need to have |
Ok, I'm in hurry for a corporate test, and I need to load a json file in a It seems to me routes file let me read certain values of json object. Thanks! Help me please! |
I can see another ways of doing this, but it has cons. Create module.exports = function() {
return {
one: require('./one.json'),
two: require('./two.json')
}
} json-server db.js Data won't be persisted and you can't watch for changes. But if it's a test, that's fine. Or, as suggested previously, manually copy the content of the JSON files and create a Sorry, I know it's not really the same as |
I said I can't make it working, I'll explain you how I'm launching it. folder: db.js, one.json, two.json I run Am I doing something wrong?
Have you tried if it works? |
My bad there was a typo in the previous code example (missing |
Thanks for the immediate reply, but it still can't work.
Do you know if this works? Is it fine how I'm running it? |
It's a little hard to tell. Can you copy paste the full error? |
It should be helpful if you could run it on your machine, to know if it certainly works. I'll repeat how I'm doing: I've all in one folder, and I launch FIXED: I was working on the wrong db.js, I tried with another on the upper position of the folder THANKS ,THANKS, THANK YOU VERY MUCH !!! |
Did a quick test, it works. Regarding the previous error:
I would check that there isn't a typo like For reference and in case someone else needs it, here's the full code that I've used: // db.js
module.exports = function() {
return {
one: require('./one.json'),
two: require('./two.json')
}
}
[
{ "id": 1, "title": "foo" }
]
[
{ "id": 1, "title": "bar" }
] $ json-server db.js |
glad it worked 😄 |
@typicode wonder if we can do something like follows. in db json. So this will enables dev's to do a pattern matching with the URL's
|
You can't in For example: {
"/api/v1_0/client/status": "/mock/clients/clientstatus.json"
} And create in Or even better: {
"/api/v1_0/client/status": "/status"
} And add an entry If it's not enough, you can use the project as a module: |
@TryRaymond Specifically #434 (comment) |
I'd like to watch more than 1 file. In the instructions it is listed
but I'm not able to make it working if I launch it as
json-server -w one.json two.json more.json
Could you help me, please? It is really important
The text was updated successfully, but these errors were encountered: