A service responsible for displaying/rendering a book reviews stored in a MongoDB.
1- Install the dependencies.
npm install
2- run the seeding script tp feed the database with 10000 reviews documents.
npm run seed
3- transpile the components.
npm run build
4- then run the server.
npm start
5- go to http://localhost:3003
& voilà...
- Node 8.11.4
- npm 5.6.0
- MongoDB
- method:
GET
. - description: retrieves the reviews associated to the book with the specified
id
. - API response: A JSON-encoded array of objects where each object represent a review. A review object would look like this:
{
"_id": "5c99be23d83f3c5994dd1e38",
"id": 20,
"image_url": "http://lorempixel.com/640/480/people",
"reviewer_name": "Rey Cummerata",
"star_rate": 5,
"review_date": "2019-03-06T09:58:19.247Z",
"review_description": "Incidunt suscipit corrupti fugit earum saepe ipsum et veritatis earum. Eius voluptatem sint perspiciatis accusamus porro deleniti aut et debitis. Iste vitae ut voluptatum dicta consequatur exercitationem dolore sed. Veritatis est et. Illo iure voluptatem voluptatem aperiam possimus. Consequatur fugiat sapiente nostrum aut quisquam magni quaerat non in.\n \rConsectetur qui adipisci. Totam qui voluptas. Aperiam minima est earum quae est labore sit.\n \rOmnis esse hic iure. Vitae qui qui amet sed asperiores repellat porro quidem soluta. Quo officia voluptatem mollitia aspernatur possimus quia. Dolore porro fugiat.",
"likes_count": 995
},
- method:
PATCH
. - description: updates the
likes_count
for the specified review depending on the current state of the button (being like or unlike). - API response:
A JSON-encoded updated review object with the new
likes_count
Before running the tests using the npm test
script, you have to prepare the environment as such:
import
react
&styled-components
in theReviews.jsx
&Review.jsx
files.import
react
&react-dom
in theindex.jsx
file.- Replace the fetch requests urls to the
localhost
instead on port3003
(in theReviews.jsx
&Review.jsx
files.)