Enter in client
and run:
npm i && ng server
And enter in http://localhost:4200
Enter in server/rest
and run:
npm i && npm run server
Resources http://localhost:9001/posts http://localhost:9001/comments http://localhost:9001/profile
Enter in server/grapql
and run:
npm i && npm run server
And enter in http://localhost:9002
Here is how you can use the queries and mutations generated for your data, using Post
as an example:
Query / Mutation | Result |
---|---|
// get a single entity, by id { Post(id: 1) { id title views user_id } } |
{ "data": { "Post": { "id": 1, "title": "Lorem Ipsum", "views": 254, "user_id": 123 } } } |
// include many-to-one relationships { Post(id: 1) { title User { name } } } |
{ "data": { "Post": { "title": "Lorem Ipsum", "User": { "name": "John Doe" } } } } |
// include one-to-many relationships { Post(id: 1) { title Comments { body } } } |
{ "data": { "Post": { "title": "Lorem Ipsum", "Comments": [ { "body": "Consectetur adipiscing elit" }, { "body": "Nam molestie pellentesque dui" }, ] } } } |
// get a list of entities for a type { allPosts { title views } } |
{ "data": { "allPosts": [ { "title": "Lorem Ipsum", views: 254 }, { "title": "Sic Dolor amet", views: 65 } ] } } |
// paginate the results { allPosts(page: 0, perPage: 1) { title views } } |
{ "data": { "allPosts": [ { "title": "Lorem Ipsum", views: 254 }, ] } } |
// sort the results by field { allPosts(sortField: "title", sortOrder: "desc") { title views } } |
{ "data": { "allPosts": [ { "title": "Sic Dolor amet", views: 65 } { "title": "Lorem Ipsum", views: 254 }, ] } } |
// filter the results using the full-text filter { allPosts( filter: { q: "lorem" }) { title views } } |
{ "data": { "allPosts": [ { "title": "Lorem Ipsum", views: 254 }, ] } } |
// filter the result using any of the entity fields { allPosts( filter: { views: 254 }) { title views } } |
{ "data": { "allPosts": [ { "title": "Lorem Ipsum", views: 254 }, ] } } |
// number fields get range filters // -lt, _lte, -gt, and _gte { allPosts( filter: { views_gte: 200 }) { title views } } |
{ "data": { "allPosts": [ { "title": "Lorem Ipsum", views: 254 }, ] } } |