Status: v1 completed
- Instructions
- About me
- Documentation
- Clone the repository :
git clone /~https://github.com/luisfelix-93/dev-tasks-server
- Access the directory :
cd /dev-task-server
- Install the dependencies:
npm istall
- Configure the environment variables in the
.env
file:MONGODB_URI={VALUE}
- Run the server:
npm start
- Access the application at:
htpp://localhost:5002/
- Fork the project
- Create a new branch:
git checkout -b my-contribution
- Make your changes and commit:
git commit -m 'My contribution'
- Submit your changes:
git push origin my-contribution
- Open a Pull-Request
- This project uses the jest lib for testing.
npm run test
This API is being developed for the dev-task-repo project. /~https://github.com/luisfelix-93/dev-task
It consists of being almost a monolith responsible for managing users and tasks in the system.
This API uses a login microsservice to provides the Bearer Token authorization. Check it on:
/~https://github.com/luisfelix-93/dev-login-server/
- This section refers to user endpoints
-
The user can registrate only 1 email
-
Request:
POST /user HTTP/1.1
Host: localhost:5002
Content-Type: application/json
Authorization: Bearer ****
Content-Length: 146
{
"userName" : "string",
"fullName" : "string",
"email" : "string",
"password" : "string"
}
- Response:
- status 200
{
"message" : "User successfully created",
"data": {
"userName" : "string",
"fullName" : "string",
"email" : "string",
"password" : "string"
}
}
- status 409
{
"message": "User already registrated!",
"data" : null
}
- status 500
{
"message": "An internal error occurred",
data: "status 500, An internal error occurred, {error}"
}
- Request:
GET /user HTTP/1.1
Host: localhost:5002
Authorization: Bearer ****
- Response
{
"message" : "Users successfully found"
"data": {
[
"userName" : "string",
"fullName" : "string",
"email" : "string",
"password" : "string"
]
}
}
- Request:
GET /user/{user_id} HTTP/1.1
Host: localhost:5002
Authorization: Bearer ****
- Response:
{
"message" : "Users successfully found"
"data": {
[
"userName" : "string",
"fullName" : "string",
"email" : "string",
"password" : "string"
]
}
}
- Request:
POST /user/{user_id}/task HTTP/1.1
Host: localhost:5002
Content-Type: application/json
Authorization: Bearer ****
Content-Length: 94
{
"taskType": string,
"dateStart" : dateTime,
"note" : string
}
- Response:
{
"message": "Task succefully created",
"data": {
"taskCode": string,
"taskType": string,
"dateStart": dateTime,
"dateEnd": null,
"note": string,
"userId": string,
"_id": objectId,
"__v": 0
}
}
- Request:
PUT /task/?taskCode={task_code} HTTP/1.1
Host: localhost:5002
Content-Type: application/json
Authorization: Bearer ****
Content-Length: 35
{
"status" : string
}
- Response:
{
"message": "Task updated to {status}",
"updatedTask": {
"_id": objectId,
"taskCode": string,
"taskType": string,
"dateStart": dateTime,
"dateEnd": dateTime,
"note": string,
"userId": string,
"__v": 0,
"status": string
}
}