Skip to content

DaBusyB/contactsAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to Contacts API 👋

Version Documentation Maintenance License: ISC Twitter: DaBusyB

A simple API to manage your contacts. This was created using Node, Express, SQLite and Knex. For testing, I'm using jest, and supertest. Heroku Postgress will be used to deploy to Heroku.

Install

npm install

Usage

npm start

Use Postman to view and manipulate routes

Run tests

npm test

Routes and Expected Output

#AUTH

*****
Register To Use API: POST /api/users/register
*****
*ensure body settings are raw JSON*
JSON
[
  <id of new entry>
]

*****
Log Into API: POST /api/users/login
*****
JSON
{
    "message": `Welcome ${username}`
}

*****
Log Out Of API: GET /api/users/logout
*****
JSON
{
    "message": `Sorry ${username}, you are NOT logged out, try again`
}
     OR
{
    "message": "Peace out, you have successfully logged out"
}

#CONTACTS - register and log

*****
List All Contacts: GET /api/contacts
*****
JSON
[
  {
      "id": 1,
      "name": "Viola Davis",
      "number": 3017660448,
      "email": "[email protected]"
  },
  {
      "id": 2,
      "name": "Nell Carter",
      "number": 2028999411,
      "email": "[email protected]"
  },
  {
      "id": 3,
      "name": "Issa Rae",
      "number": 4102229876,
      "email": "[email protected]"
  },
  {
      "id": 7,
      "name": "Eartha Kitt",
      "number": 9194899231,
      "email": "[email protected]"
  }
]

*****
List Contacts by Their ID: GET /api/contacts/<id>
*****
JSON
[
    {
        "id": 1,
        "name": "Viola Davis",
        "number": 3017660448,
        "email": "[email protected]"
    }
]

*****
Add a Contact: POST /api/contacts
*****
*ensure body settings are raw JSON*
JSON
[
  <id of new entry>
]

*****
Edit a Contact: PUT /api/contacts/<id>
*****
JSON
{
  "updated": <number of entries updated>
}

*****
Delete a Contact: DELETE /api/contacts/<id>
*****
JSON
{
  "deleted": <number of entries deleted>
}

Author

👤 Brandi Apetsi

🤝 Contributing

Contributions and suggestions are welcome!

Show your support

Give a ⭐️ if this project helped you!

📝 License

Free to copy and or use


This README was generated with ❤️ by readme-md-generator

About

A contacts database using SQLite 3, Node, Express, Knex

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published