-
Make sure
npm,git,MongoDBare installed. -
Clone the project
git clone https://github.com/mayel15/Delivecrous.git- Install the necessary dependencies
cd Delivecrous npm install express
npm install nodemon
npm install mongoose
npm install body-parser
npm install jsonwebtoken
npm install dotenv
npm install corsOnly GET /, GET /dishes, GET /dishes/{id}, POST /login and POST /sign_up don't need account to access.
| Method | Endpoints | Description |
|---|---|---|
GET |
/ |
Get the Welcome Message :-) |
GET |
/dishes |
Get all the dishes |
GET |
/dishes/${id} |
Get a particular dish by id |
GET |
/cart |
Get the dishes of a cart |
POST |
/login |
Sign in with login and password |
POST |
/sign_up |
Sign up with login and password |
POST |
/dishes |
Add a new dish to the collection |
POST |
/cart/${id} |
Add a dish to the cart by its id |
POST |
/order_confirmation |
For confirming an order |
DELETE |
/dishes/${id} |
Delete a dish from the collection by its id |
DELETE |
/cart/${id} |
Delete a dish from the cart by its id |
- Run the server
npm start You can find the Delivecrous collection in the file named : Delicrous API - Pape THIAM.postman_collection.
For using token, you need to:
- Register with
POST /sign_upusing login and password - Login with
POST /loginusing login and password - Copy the token and paste it on
Authorization > Baerer Token > ${token} - You can in the same occasion add new dishes with
POST /dishesusing the attributes (name, description, price) - You can also add some dishes in the cart with
POST /cart/${id}
- Run the server
npm start - Open the file
front/html/index.html - Surf on the web app, order some dishes, and enjoy :-)
The easy way to fix CORS, is to download chrome extension here