namakurohman93 / contact-everywhere

Contact Everywhere, simple app for keep your contact list

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

contact-everywhere

Contact Everywhere, simple app for keep your contact list

Link Deploy

it is recommended to open frontend link with your smartphone or smaller display.

Base URL

By default, base url is at http://localhost:3000

Setting up environment

Make a file called .env and fill it with necessary environment such as:

  • PORT
  • JWT_SECRET

and put it on server folder


Routes

POST /login

Authenticate Authorized
No No

body request :

  • email type: String required
  • password type: String required

response :

// success
{
    "token": <token>,
    "username": <username>
}

// error
{
    "errors": [
        "Email or password is wrong"
    ]
}

POST /register

Authenticate Authorized
No No

body request :

  • username type: String required
  • email type: String required
  • password type: String mininum 6 character required

response :

// success
{
    "token": <token>,
    "username": <username>
}

// error
{
    "errors": [
        "Email already registered"
    ]
}

GET /contacts

Authenticate Authorized
Yes No

response:

// success
[
    {
        "id": <id>,
        "name": <name>,
        "phoneNumber": <phone number>,
        "UserId": <user id>,
        "createdAt": <created at>,
        "updatedAt": <updated at>
    }
]

// error
{
    "errors": [
        "Token is missing"
    ]
}

POST /contacts

Authenticate Authorized
Yes No

headers request :

  • token type: String required

body request :

  • name type: String required
  • phoneNumber type: String required

response :

// success
{
  "id": <id>,
  "name": <name>,
  "phoneNumber": <phone number>,
  "UserId": <user id>,
  "createdAt": <created at>,
  "updatedAt": <updated at>
}

// error
{
    "errors": [
        "Contact name is required"
    ]
}

PATCH /contacts/<:contactId>

Authenticate Authorized
Yes Yes

headers request :

  • token type: String required

params request :

  • contactId type: String required

body request:

  • name type: String
  • phoneNumber type: String

response :

// success
{
  "id": <id>,
  "name": <name>,
  "phoneNumber": <phone number>,
  "UserId": <user id>,
  "createdAt": <created at>,
  "updatedAt": <updated at>
}

// error
{
    "errors": [
        "Contact not found"
    ]
}

DELETE /contacts/<:contactId>

Authenticate Authorized
Yes Yes

headers request :

  • token type: String required

params request :

  • contactId type: String required

response :

// success
{
    "message": "Success delete contact"
}

// error
{
    "errors": [
        "Contact not found"
    ]
}

About

Contact Everywhere, simple app for keep your contact list

License:MIT License


Languages

Language:CSS 51.8%Language:JavaScript 29.9%Language:HTML 18.3%