I've tried to run the custom route example included in the project's README.md (see here), but unfortunately json-server throws an error.
I'm running json-server v0.14.2.
Here's the document (api.json):
{
"/api/*": "/$1",
"/:resource/:id/show": "/:resource/:id",
"/posts/:category": "/posts?category=:category",
"/articles\\?id=:id": "/posts/:id"
}
Here's the output:
rmam:test $ json-server --watch api.json
^K
\{^_^}/ hi!
Loading api.json
Done
Error: Oops, found / character in database property '/api/*'.
/ aren't supported, if you want to tweak default routes, see
https://github.com/typicode/json-server/#add-custom-routes
at validateKey (/usr/lib/node_modules/json-server/lib/server/router/validate-data.js:8:11)
at Array.forEach (<anonymous>)
at module.exports.obj (/usr/lib/node_modules/json-server/lib/server/router/validate-data.js:14:22)
at Object.module.exports [as router] (/usr/lib/node_modules/json-server/lib/server/router/index.js:44:3)
at createApp (/usr/lib/node_modules/json-server/lib/cli/run.js:50:27)
at load.then.db (/usr/lib/node_modules/json-server/lib/cli/run.js:132:13)
I've tried to run the custom route example included in the project's README.md (see here), but unfortunately json-server throws an error.
I'm running json-server v0.14.2.
Here's the document (api.json):
Here's the output: