Test your routes in PostMan with the following...
-
Register a new user - POST http://localhost:5000/api/users
Headers key value Content-Type application/json
Body
{
"name": "Sam Smith",
"email": "sam@gmail.com",
"password": "123456"
}
- Login a user - POST http://localhost:5000/api/auth
Headers | |
---|---|
key | value |
Content-Type | application/json |
Body
{
"email": "sam@gmail.com",
"password": "123456"
}
- Get logged in user - GET http://localhost:5000/api/auth
Headers | |
---|---|
key | value |
Content-Type | application/json |
x-auth-token | <VALID_TOKEN> |
- Get a users contacts - GET
Headers | |
---|---|
key | value |
Content-Type | application/json |
x-auth-token | <VALID_TOKEN> |
- Add a new contact - POST http://localhost:5000/api/contacts
Headers | |
---|---|
key | value |
Content-Type | application/json |
x-auth-token | <VALID_TOKEN> |
Body
{
"name": "William Williams",
"email": "william@gmail.com",
"phone": "77575894"
}
- Update a contact - PUT http://localhost:5000/api/contacts/<CONTACT_ID>
Headers | |
---|---|
key | value |
Content-Type | application/json |
x-auth-token | <VALID_TOKEN> |
Body
{
"phone": "555555"
}
- Delete a contact - DELETE http://localhost:5000/api/contacts/<CONTACT_ID>
Headers | |
---|---|
key | value |
Content-Type | application/json |
x-auth-token | <VALID_TOKEN> |
Install dependencies
npm install
cd client
npm install
Edit your /config/default.json file to include the correct MongoDB URI
npm run dev # Express & React :3000 & :5000
npm run server # Express API Only :5000
npm run client # React Client Only :3000