RESTful API to support NS8 user tracking.
RESTful API to support NS8 user tracking.
npm i
tsc
node ./dist/start
creates a new user
{
"email": "test@ns8.com",
"password": "passwordIsPizza",
"phone": "333-222-1111"
}
returns all users
{
"statusCode": 200,
"message": "Success: OK",
"data": [
{
"id": 1,
"email": "xy@xx.com",
"password": "zxczxczxczxc"
},
{
"id": 2,
"email": "xx@xx.com",
"password": "zxczxczxczxc",
"phone": "954-397-1744"
}
]
}
return user by id
{
"statusCode": 200,
"message": "Success: OK",
"data": {
"id": 1,
"email": "xx@xx.com",
"password": "zxczxczxczxc",
"phone": "954-397-1744"
}
}
create an event for the user id
{
"type": "login",
"created": "2019-13-31"
}
returns events for the user id
{
"statusCode": 200,
"message": "Success: OK",
"data": [
{
"id": 1,
"userId": 1,
"type": "login",
"created": "2019-12-31T00:00:00.000Z"
},
{
"id": 2,
"userId": 1,
"type": "login",
"created": "2019-12-31T00:00:00.000Z"
}
]
}
returns all events of all users
{
"statusCode": 200,
"message": "Success: OK",
"data": [
{
"id": 1,
"userId": 1,
"type": "login",
"created": "2019-12-31T00:00:00.000Z"
},
{
"id": 2,
"userId": 1,
"type": "login",
"created": "2019-12-31T00:00:00.000Z"
},
{
"id": 3,
"userId": 2,
"type": "created",
"created": "2019-12-31T00:00:00.000Z"
},
{
"id": 4,
"userId": 2,
"type": "login",
"created": "2019-12-31T00:00:00.000Z"
},
{
"id": 5,
"userId": 3,
"type": "deleted",
"created": "2019-12-31T00:00:00.000Z"
}
]
}
returns all events of all users in the last day
{
"statusCode": 200,
"message": "Success: OK",
"data": [
{
"id": 1,
"userId": 1,
"type": "login",
"created": "2019-12-31T00:00:00.000Z"
},
{
"id": 2,
"userId": 2,
"type": "login",
"created": "2019-12-31T00:00:00.000Z"
},
{
"id": 3,
"userId": 2,
"type": "created",
"created": "2019-12-31T00:00:00.000Z"
}
]
}
{
"statusCode": 400,
"message": "Error: Bad Request",
"data": {
"message": "Request Error - phone format: ###-###-####"
}
}
{
"statusCode": 404,
"message": "user not found"
}
{
"statusCode": 500,
"message": "Internal Server error"
}