Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamestang12/contact-manager-api
This is a Node/Express/MongoDB REST API for Contact Manager that uses JWT authentication, allow application and users to manager contacts from the database
https://github.com/jamestang12/contact-manager-api
database express json jwt-authentication mongodb mongodb-database mongoose nodejs
Last synced: 8 days ago
JSON representation
This is a Node/Express/MongoDB REST API for Contact Manager that uses JWT authentication, allow application and users to manager contacts from the database
- Host: GitHub
- URL: https://github.com/jamestang12/contact-manager-api
- Owner: jamestang12
- Created: 2020-04-19T19:59:47.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:48:16.000Z (almost 2 years ago)
- Last Synced: 2023-03-07T22:20:12.880Z (over 1 year ago)
- Topics: database, express, json, jwt-authentication, mongodb, mongodb-database, mongoose, nodejs
- Language: JavaScript
- Size: 399 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Contact-Manager-API
This is a Node/Express/MongoDB REST API for Contact Manager that uses JWT authentication, allow application and users to manager contacts from the database## Getting Started
```
Open the config/default.json file and add your mongoURI and your jwtSecret
``````bash
npm install
npm run server # Runs on http://localhost:5000
```# API Usage & Endpoints
## Register a User [POST /api/users]
- Request: Add user and request JSON web token
- Headers
Content-type: application/json
- Body
{
"name": "",
"email": "",
"password": ""
}- Response: 200 (application/json)
- Body
{
"token": ""
}## Login with a User [POST /api/auth]
- Request: Login with credentials to recieve a JSON web token
- Headers
Content-type: application/json
- Body
{
"email": "",
"password": ""
}- Response: 200 (application/json)
- Body
{
"token": ""
}## Get Contacts [GET /api/contacts]
- Request: Get all contacts of a specific user
- Headers
x-auth-token: YOURJWT
* Response: 200 (application/json)
- Body
{
"contacts": []
}## Add New Contact [POST /api/contacts]
- Request: Add a new contact
- Headers
x-auth-token: YOURJWT
Content-type: application/json- Body
{
"name": "",
"email": "",
"phone": "",
"type": "" [personal or professional]
}- Response: 200 (application/json)
- Body
{
"contact": {}
}## Update Contact [PUT /api/contacts/:id]
- Request: Update existing contact
- Parameters
- id: 1 (number) - An unique identifier of the contact.
- Headers
x-auth-token: YOURJWT
Content-type: application/json- Body
{
"name": "",
"email": "",
"phone": "",
"type": "" [personal or professional]
}- Response: 200 (application/json)
- Body
{
"contact": {}
}## Delete Contact [DELETE /api/contacts/:id]
- Request: Delete existing contact
- Parameters
- id: 1 (number) - An unique identifier of the contact.
- Headers
x-auth-token: YOURJWT
* Response: 200 (application/json)
- Body
{
"msg": "Contact removed"
}