Skip to content

Commit 67698b3

Browse files
authored
Update Readme.md
1 parent 30c53f8 commit 67698b3

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

Readme.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,49 @@ GET http://localhost:3000/api/v1/comments?limit=2&offset=1
8888
This project is built using node.js with express.js framework, postgres database using sequelize and third party api integration (SWAPI).
8989

9090
It is simple rest api app that use json web token and SWAPI (The Star Wars API). Once register then login and get token.
91-
and later all requests use jwt token http header(`x-access-token`) for sending authenticated requested
91+
and later all requests use jwt token http header(`x-access-token`) for sending authenticated requested.
92+
93+
```
94+
SPECIFICATION
95+
REST API with postgres database and usage of external JSON API with simple json web token authentication. Full specification of routes below:
96+
97+
POST /register:
98+
Request body should containing planet's username and secret in request body.
99+
Response will return HTTP 201 with empty body.
100+
101+
POST /login:
102+
Request body should containing planet's username and secret in request body.
103+
Response will return HTTP 200 with the fetched token as response's body.
104+
105+
Now below Only authorized request should be allowed, not-authorized requests should receive proper HTTP error.
106+
107+
POST /planets:
108+
Request body should containing planet's name,
109+
Request data will be validated and accept only name as a string,
110+
Additional data will be fetched from https://swapi.co/, aginst provided planet name and saved to database,
111+
response will return HTTP 201 with the fetched data as response's body.
112+
113+
GET /planets:
114+
List all planets from database,
115+
Pagination, filtering and sorting on id basis is added!
116+
117+
GET /planets/:id
118+
It will return a planet by id from database,
119+
120+
POST /comments:
121+
Request will contains comment's text and planet's ID,
122+
it will add a comment to a given planet and return that comment as response body.
123+
124+
GET /comments:
125+
it will fetch list of all comments from database and allow for filtering, pagination by planet using /comments?planet=:planet_id&limit=1&offset=1 query parameter.
126+
127+
DELETE /planets/:id
128+
It will remove a given planet from database.
129+
130+
PUT /planets/:id
131+
It will update a given planet by id in database.
132+
133+
```
92134

93135
#### Backend
94136

@@ -146,4 +188,4 @@ Postman collection is added for testing in local system and heroku
146188
* [Node.js ES2015/ES6, ES2016 and ES2017 support](http://node.green/)
147189
* [SWAPI - The Star Wars API](https://swapi.co/documentation#planets)
148190
* [Docker Documentation](https://docs.docker.com/)
149-
* [Docker Compose](https://docs.docker.com/compose/overview/)
191+
* [Docker Compose](https://docs.docker.com/compose/overview/)

0 commit comments

Comments
 (0)