|
||
---|---|---|
.gitignore | ||
LICENSE | ||
README.md | ||
db.json | ||
package-lock.json | ||
package.json | ||
routes.json |
README.md
json-server-example
Basic example of a simple REST-API made with json-server.
Installation
npm install json-server
Data source: db.json
Additional routes: routes.json
Start server
json-server --watch db.json
REST-Endpoints
GET
-
All classes: http://localhost:3000/classes
-
All students: http://localhost:3000/students
-
Anna Arm: http://localhost:3000/students?firstname=Anna&lastName=Arm
-
students with "r" in firstName: http://localhost:3000/students?firstName_like=r
-
All students with their classe: http://localhost:3000/students?_expand=class
-
DOESN'T WORK: All classes with their students: http://localhost:3000/classes?_expand=student
-
All students of class 1: