@@ -26,11 +26,18 @@ Generates the endpoints (or a whole app) from a mapping (SQL query -> URL)
2626 WHERE cs.collection_id = :collectionId
2727
2828 - path: /v1/categories
29+ get_list: >-
30+ SELECT id, name, name_ru, slug
31+ FROM categories
2932 post: >-
3033 INSERT INTO categories(name, slug, created_at, created_by, updated_at, updated_by)
3134 VALUES (:name, :slug, NOW(), :userId, NOW(), :userId)
3235
3336 - path: /v1/categories/:categoryId
37+ get: >-
38+ SELECT id, name, name_ru, slug
39+ FROM categories
40+ WHERE id = :categoryId
3441 put: >-
3542 UPDATE categories
3643 SET name = :name, name_ru = :nameRu, slug = :slug, updated_at = NOW(), updated_by = :userId
@@ -78,11 +85,15 @@ Generates the endpoints (or a whole app) from a mapping (SQL query -> URL)
7885 ETag: W/"a-bAsFyilMr4Ra1hIU5PyoyFRunpI"
7986 Date: Wed, 15 Jul 2020 18:06:33 GMT
8087 Connection: keep-alive
88+ $ curl http://localhost:3000/v1/categories
89+ [{"id":1,"name":"Sport","name_ru":"Спорт","slug":"sport"}]
8190 $ curl -i -H 'Content-Type: application/json' -d '{"name":"Fauna","nameRu":"Фауна","slug":"fauna","userId":101,"categoryId":1}' -X PUT http://localhost:3000/v1/categories/1
8291 HTTP/1.1 204 No Content
8392 ETag: W/"a-bAsFyilMr4Ra1hIU5PyoyFRunpI"
8493 Date: Wed, 15 Jul 2020 18:06:34 GMT
8594 Connection: keep-alive
95+ $ curl http://localhost:3000/v1/categories/1
96+ {"id":1,"name":"Fauna","name_ru":"Фауна","slug":"fauna"}
8697 $ curl -i -X DELETE http://localhost:3000/v1/categories/1
8798 HTTP/1.1 204 No Content
8899 ETag: W/"a-bAsFyilMr4Ra1hIU5PyoyFRunpI"
0 commit comments