Giter Club home page Giter Club logo

heart-rate-monitor-api's Introduction

Command...

npm start or yarn start

Host

API

Verify User

GET /verify_token Require Header 'Authorization'

  • Response
{
    "user": {
        "profile": {
            "dob": "2021-01-01T00:00:00.000Z",
            "fullName": "Danh Phi Long",
            "gender": "male",
            "weight": 100,
            "height": 100
        },
        "_id": "60a29be96b48020f0ceeb155",
        "username": "long9ka",
        "password": "$2b$10$E8d...",
        "__v": 0
    }
}
  • Error (401 Unauthorized)
{
    "msg": "authorization denied"
}

Register

POST /register

  • Request
{
	"username": "long9ka",
	"password": "123456",
	"profile": {
		"fullName": "Danh Phi Long",
		"gender": "male",
		"weight": 100,
		"height": 100,
		"dob": "2021-01-01"
	}
}
  • Response
{
    "user": {
        "profile": {
            "dob": "2021-01-01T00:00:00.000Z",
            "fullName": "Danh Phi Long",
            "gender": "male",
            "weight": 100,
            "height": 100
        },
        "_id": "60a29be96b48020f0ceeb155",
        "username": "long9ka",
        "password": "$2b$10$...",
        "__v": 0
    }
}
  • Error (500 Server Error)
{
    "msg": "server error"
}

Login

POST /login

  • Request
{
	"username": "long9ka",
	"password": "123456"
}
  • Response
{
    "user": {
        "profile": {
            "dob": "2021-01-01T00:00:00.000Z",
            "fullName": "Danh Phi Long",
            "gender": "male",
            "weight": 100,
            "height": 100
        },
        "_id": "60a29be96b48020f0ceeb155",
        "username": "long9ka",
        "password": "$2b$10$E8d...",
        "__v": 0
    },
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
  • Error (400 Bad Request)
{
    "msg": "invalid credentials"
}

Get Users

GET/users Require Header 'Authorization'

  • Response
{
    "users": [
        {
            "profile": {
                "dob": "2021-01-01T00:00:00.000Z",
                "fullName": "Danh Phi Long",
                "gender": "male",
                "weight": 100,
                "height": 100
            },
            "_id": "60a29be96b48020f0ceeb155",
            "username": "long9ka",
            "password": "$2b$10$E8d...",
            "__v": 0
        }
    ]
}

Get User By ID

GET/users/:id Require Header 'Authorization'

  • Response
{
    "user": {
        "profile": {
            "dob": "2021-01-01T00:00:00.000Z",
            "fullName": "Danh Phi Long",
            "gender": "male",
            "weight": 100,
            "height": 100
        },
        "_id": "60a29be96b48020f0ceeb155",
        "username": "long9ka",
        "password": "$2b$10$E8d...",
        "__v": 0
    }
}

Create Record

POST /heart_rate_records Require Header 'Authorization'

  • Request
{
	"heartRate": 100,
	"state": "ok"
}
  • Response
{
    "heartRate": {
        "date": "2021-05-17T16:52:54.550Z",
        "_id": "60a29f698ff6de0fb9f12a12",
        "userId": "60a29be96b48020f0ceeb155",
        "heartRate": 100,
        "__v": 0
    }
}

Get Records

GET /heart_rate_records Require Header 'Authorization'

  • Response
{
    "heartRates": [
        {
            "date": "2021-05-17T16:52:54.550Z",
            "_id": "60a29f698ff6de0fb9f12a12",
            "userId": "60a29be96b48020f0ceeb155",
            "heartRate": 100,
            "__v": 0
        },
        {
            "date": "2021-05-17T16:56:34.241Z",
            "_id": "60a2a052a94b710fe761953e",
            "userId": "60a29be96b48020f0ceeb155",
            "heartRate": 200,
            "__v": 0
        }
    ]
}

Get Record By ID

GET /heart_rate_records/:id Require Header 'Authorization'

  • Response
{
    "heartRate": {
        "date": "2021-05-17T16:56:34.241Z",
        "_id": "60a2a052a94b710fe761953e",
        "userId": "60a29be96b48020f0ceeb155",
        "heartRate": 200,
        "__v": 0
    }
}

Get Record By ID

GET /users/profile Require Header 'Authorization'

  • Response
{
	"fullName": "Quan Hai 8",
	"gender": "female"
}
{
    "profile": {
        "dob": "2021-06-15T15:40:32.740Z",
        "fullName": "Quan Hai 8",
        "gender": "female"
    },
    "_id": "60c8c49ddaaea80015a08c83",
    "username": "quanghai29",
    "password": "$2b$10$vVyK6MbY4bT32Q82Gwxh0.QxpM/cssx5ZOy5yYOGRcR/NyINws9Q.",
    "__v": 0
}

heart-rate-monitor-api's People

Contributors

long9ka avatar quanghai29 avatar dungbuitien1999 avatar

Watchers

James Cloos avatar  avatar

Forkers

quanghai29

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.