ExpressJS - OXA Four square Level badge

restfulapi

Table of contents

Introduction

Express.js Node.js

Here i was built the oxa foursquare badge level. in this application you must check in to upgrade your badge level, you can check in different location all day, but you can just only checkin one day in one location. if check-in meets the requirements then the level badge will go up. you must login to check-in

Express.js, or simply Express, is a web application framework for Node.js. More about Express

Requirements

  1. node_modules
  2. Postman
  3. Web Server (ex. localhost)

How to run the app ?

  1. Open CMD or Terminal and enter to the app directory
  2. Type npm install
  3. Turn on Web Server and MySQL can using Third-party tool like xampp, etc.
  4. import database to mysql
  5. Open Postman desktop application or Chrome web app extension that has installed before
  6. Choose HTTP Method and enter request url.(ex. localhost:3000/notes)
  7. You can see all the end point here

Set up connect.js file

Open .env file on your favorite code editor, and copy paste this code below :

DB_HOST=localhost
DB_USER=root // default
DB_PASS= // default
DB_NAME=oxa_badge

End Point List

1. USER

  • post(/user) (create new user)
  • post('/login') (login api to get token) body form json for user
    { email: "", password: "", }

2. BADGE

  • get(/badge) (get badge )
  • post(/badge) (create new badge )
  • patch(/badge/:id) (update badge )
  • delete(/badge/:id) (delete badge ) body form json for user
    { name: "", check_in: "", level: "", }

3. LOCATION

  • get(/location) (get location )
  • post(/location) (post location )
  • patch(/location/:id) (update location )
  • delete(/location/:id) (delete location) body form json for user
    { name: "", check_in: "", level: "", }

4. Check In

  • get(/userbadge) (get data user with badge)
  • get(/allBadge) (get all data user with badge)
  • patch(/checkIn) (check in ) body form json for checkin
    { id_location: "", }

Screenshot from the app