Browse Source

[docs]

Signed-off-by: Muthu Kumar <muthukumar@thefeathers.in>
master
Muthu Kumar 4 years ago
parent
commit
63136899ab
Signed by: mkrhere GPG Key ID: 3FD688398897097E
  1. 83
      README.md
  2. 4
      index.js

83
README.md

@ -0,0 +1,83 @@
# Routes
## POST `/register`
### Request type: `application/json`
### Request:
- username: `string`
- email: `string`
- password: `string`
### Response:
- success: `boolean`
- msg: `string` (if success false)
## POST `/user`
### Request type: ``application/json``
### Request:
- username: `string`
- password: `string`
### Response:
- success: `boolean`
- msg: `string` (if success false)
- token: `string`
## GET `/search/:query`
### Headers:
- Authentication: `token`
### Response:
- success: `boolean`
- msg: `string` (if success false)
- results: `object array`
- movieId: `string`
- title: `string`
- overview: `string`
- poster: `string`
- release: `string`
## GET `/movie/:movieId`
### Headers:
- Authentication: `token`
### Response:
- success: `boolean`
- msg: `string` (if success false)
- data:
- movieId: `string`
- title: `string`
- overview: `string`
- poster: `string`
- release: `string`
- watchStatus: `undefined|string`
- rating: `undefined|string`
## POST `/movie/:movieId`
### Headers:
- Authentication: `token`
### Request type: ``application/json``
### Request:
- watchStatus: `string ∈ ["PLANNED", "IN_PROGRESS", "COMPLETED"]`
- rating: `string ∈ ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]`
### Response:
- success: `boolean`
- msg: `string` (if success false)
- data:
- movieId: `string`
- title: `string`
- overview: `string`
- poster: `string`
- release: `string`
- watchStatus: `undefined|string`
- rating: `undefined|string`

4
index.js

@ -188,7 +188,7 @@ const getProot = () =>
title: result.title,
};
res.send(movie);
res.send({ success: true, data: movie });
await Movie.create(movie);
} else {
@ -209,7 +209,7 @@ const getProot = () =>
delete movie._id;
delete movie.__v;
res.send(movie);
res.send({ success: true, data: movie });
}
} catch (e) {
console.error("ERR on /movie", e.message);

Loading…
Cancel
Save