Open SteveGFortescue opened 5 months ago
afaik this option is not available in 1.0.0
The documentation for --routes
only refers to 0.x.x releases
Will this option be available in the final v1 version?
How else can we make API routes that are level 2 or deeper? For example /api/users ?
I went back to older version
It doesn't make sense to remove a feature after it's been out?
This change is unfortunate. I attempted to use json-server for the Angular Tour of Heroes tutorial, but the URL in that example is "api/heroes" and so I really needed the --routes support to strip out the "api" prefix.
I suppose as a work-around I can fiddle with the environment config in Angular to parameterized the URL, but it's simpler to just have the prefix stripped out when using json-server instead of HttpClientInMemoryWebApiModule.
I went back to older version
What version?
I downgraded to the latest stable version (0.17.4) and I still see the error message “Unknown option ‘--routes’”.
Just use the "json-server": "^0.17.4" in your package.json. Unfortunately, the documentation does not match the latest version of json-server, which is "1.0.0-beta.1", as I am writing this comment. Routes are not included in the latest release.
Is this feature intentionally missing from the beta version? Just wanting to know if this is a feature that will be available in later stable releases.
@dillonrowan 0.x.x was built on express, v1.x.x uses tinyhttp with no documented rewrite option. Tried to modify url using Th middleware with no luck.
I can't see this issue documented anywhere else and have tried different versions of json-server
Running on Apple M1 Pro Node: 20.9.0 json-server: 1.0.0-alpha.23
Have tried running from npx, json-server as global as well as local and both. running the following
json-server --watch ./data/db.json --port 8000 --routes ./data/routes.json
results in the error below`npx json-server --watch ./data/db.json --port 8000 --routes ./data/routes.json
Unknown option '--routes' Usage: json-server [options]
Options: -p, --port Port (default: 3000)
-h, --host Host (default: localhost)
-s, --static Static files directory (multiple allowed)
--help Show this message
--version Show version number`
The documentation says
--routes
is an option but the package in npm does not contain it?