MERN Stack Web application Features Redux for state management
Create a .env file in the root of the project Copy the following files onto it and specify your appropriate MONGO_URI
NODE_ENV = development
PORT = 5000
MONGO_URI =
Install dependencies
npm install
cd frontend && npm install
cd ..
Make sure you are connected to MongoDB atlas by specifying appropriate environment variable values.
npm run server # Express API :5000
npm run dev # MERN APP
Test your routes in PostMan with the following…
Get all products - GET http://localhost:5000/api/products
Get a specific product - GET http://localhost:5000/api/products/:id
Body
{
"rating": 4.5,
"numReviews": 4,
"price": 89.99,
"countInStock": 3,
"_id": "",
"name": "Airpods Wireless Bluetooth Headphones",
"image": "/images/airpods.jpg",
"description": "Bluetooth technology lets you connect it with compatible devices wirelessly High-quality AAC audio offers immersive listening experience Built-in microphone allows you to take calls while working",
"brand": "Apple",
"category": "Electronics",
"user": "",
"__v": 0,
"createdAt": "2020-11-09T19:10:20.499Z",
"updatedAt": "2020-11-09T19:10:20.499Z"
}
Register a user - POST http://localhost:5000/api/users
Login a user - POST http://localhost:5000/api/users/login
Get a specific user - GET http://localhost:5000/api/users/profile
Update a specific user - PUT http://localhost:5000/api/users/profile
Author: sujitmohanty
Source Code: https://github.com/sujitmohanty/shipkart
#react #reactjs #javascript