Clone repository
git clone https://github.com/Karthik-Sunil-K/Blog-API.git
cd Blog-API/
Initiate npm
npm init
Install npm packages
npm i express nodemon bcrypt mongoose dotenv
Now create .env
file
Add the mongodb url in .env file
MONGO_URL=mongodb+srv://karthik:[email protected]/?retryWrites=true&w=majority
Add this script in package.json
"scripts": {
"start": "nodemon app.js"
},
Start server
nodemon start
-http://localhost:3000
Register User:
POST /api/v1/auth/register/
Example Input:
{
"username": "nodemon app.js",
"email":"[email protected]",
"password":"1234"
},
Output:
{
message:"user created succesfully"
}
Login user
POST /api/v1/auth/login/
Example Input:
{
"username": "nodemon app.js",
"password":"1234"
},
Output:
{
message: "logined successfully",
}
user routes:
PUT /api/v1/user/update/:id
DELET /api/v1/user/update/:id
GET /api/v1/user/update/:id
PATCH /api/v1/user/update/:id