A REST Express API, has various endpoints that perform sign in and sign up
Ahmad Arman
- (link heroku ready to test on postman)[https://ahmad-basic-auth.herokuapp.com/api/v1/signup]
- (link heroku ready to test on postman)[https://ahmad-basic-auth.herokuapp.com/api/v1/signin]
- Submission Pull Request
- Deployed App
- Error Report
(.env)
file
PORT = 3000
MONGOOSE_URI = mongodb://localhost:27017/people
MONGOOSE_URI = mongodb+srv://ahmad:eng.ahmad123@cluster0.kilwd.mongodb.net/infUser?retryWrites=true&w=majority
MONGOOSE_TEST_URI = mongodb+srv://ahmad:eng.ahmad123@cluster0.kilwd.mongodb.net/testing?retryWrites=true&w=majority
- Install the following dependencies
npm init -y
npm i cors dotenv express morgan mongoose "base-64" :
"bcrypt":
"dotenv":
"express":
"mongoose":
mongod --dbpath=/Users/path/to/data/db
- clone the repo.
- Enter the command
npm start
- Use endpoints :
- Method : post
- CRUD Operation : http://localhost:3000/api/v1/signin
- Response Body : JSON
[
{
"user": {
"_id": "60aae63fbcdc5d6877e732b8",
"username": "aaaa",
"password": "$2b$10$FiM6T4pbjS8DAYnz3JgDUeDVreQn5pZjgrIoTFqFwF0vg72dMXcBu",
"__v": 0
}
}
]
- Method : POST
- CRUD Operation : http://localhost:3000/api/v1/signup
- Response Body : JSON
{
"user": {
"_id": "60aae63fbcdc5d6877e732b8",
"username": "aaaa",
"password": "$2b$10$FiM6T4pbjS8DAYnz3JgDUeDVreQn5pZjgrIoTFqFwF0vg72dMXcBu",
"__v": 0
}
}
- Test .
- There's 2 test files . logger.test.js and server.test.js
- In terminal run :
npm test