Comments (5)
Hi Ingro, always happy to know my projects are appreciated, thanks :)
Not really sure to undersdand your example, because I don't see user
in your code. What does generate.js
outputs and how do you get /user
?
from json-server.
Oh I think I'm getting it. When you get /user
, the response is the structure you've shown:
{
"data": [
{
"id": 1,
"name": "John"
},
// ...
And because user list is in data
, you can't get /user/1
.
from json-server.
Yeah sorry it wasn't clear on the first thought, that was the response I expect from the server. I need the meta
data to manage the pagination on the client application, but as you guessed I can't get a specific user structuring the data in this way.
Completely out of scope but, great avatar choice! :)
from json-server.
Thanks, good choice for Radiohead :)
Unfortunately, I don't see a way to use that kind of structure with this project. It would mean creating some all new routes.
And POST, DELETE would need to update the meta properties too.
The current approach in JSON Server for pagination, is to use _start
, _end
query parameters and the X-TOTAL-COUNT
header.
Sorry about that.
Maybe you can have a look at dyson or interfake.
Also, I think it wouldn't take too long to create a custom fake server using Express. Actually, if you look at src/router.js
you'll see that the code is quite simple.
Hope it will help.
from json-server.
Well thanks for your suggestions, I will look at the resources you linked me, I think you can close this issue, keep up the good work! :D
from json-server.
Related Issues (20)
- How do I encrypt json-server HTTP requests? HOT 1
- problem in pagination HOT 1
- Why doesn't the "name_like" parameter work in the latest version of the JSON server? HOT 1
- error/bug in the json server showing INT value as a STRING HOT 2
- Running "json-server --watch ./data/db.json --port 8000 --routes ./data/routes.json" results in the error "Unknown option '--routes'" HOT 5
- Issues with installing to non alpha version HOT 3
- How do I set up a unique road handler? HOT 1
- Error on : json-server --watch db.json HOT 1
- query parameter does not working HOT 3
- Weird behaviour when property "period" is in json mock data
- Steps to serve multiple json files with json-server HOT 3
- `_gte` and `_lte` doesn't work for dates HOT 3
- In new version not working `_sort=price&_order=asc` , please fix this issue.
- Multiple filters not working
- Whats cuestión? For the api?
- cors problem HOT 2
- Has the --delay option been removed? HOT 4
- not working at all
- conditional operators doesn't work
- I have a problem opening Json-server --watch.db.json HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-server.