A memorization system based on the Ebbinghaus Deterioration Theory.
-
User creates a login (name, email, password).
-
User logs in and receives a token.
-
User can create a note, grab them all, get notes that need to be reviewed today, review notes, delete notes and edit notes.
POST /sign-up
Send a request body in this format:
{
name: 'fulana',
email: 'fulana@gmail.com',
password: '123456',
confirmPassword: '123456'
}
| body | type | description |
|---|---|---|
| name | string | valid name |
| string | valid email | |
| password | string | at least 6 characters |
| confirmPassword | string | equal to password |
| code | description |
|---|---|
| 422 | request body is invalid |
| 409 | email already registred |
| 201 | created |
POST /sign-in
Send a request body in this format
{
email: fulano@gmail.com,
password: 123456
}
| body | type | description |
|---|---|---|
| string | valid email | |
| password | string | valid password |
| code | description |
|---|---|
| 422 | request body is invalid |
| 401 | email doesn't exist or password doesn't match |
| 200 | ok, returns a token |
{
token: jyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9ASASASADL;;
}
POST /notes
Send a Authorization Header with format Bearer Token, and a Request Body in this format:
{
"title": "How vaccines work",
"content": "Vaccines differ from other medical drugs in two important ways..."
}
| body | type | description |
|---|---|---|
| title | string | valid title |
| content | string | valid content |
| code | description |
|---|---|
| 422 | request body is invalid |
| 401 | invalid or non-existent token |
| 201 | created |
PATCH /notes/:id
Send a Authorization Header with format Bearer Token, param id and a Request Body in this format:
{
"content": "Vaccines differ from other medical drugs in two important ways edited..."
}
| body | type | description |
|---|---|---|
| content | string | valid content |
| param | type | description |
|---|---|---|
| id | number | valid note id |
| code | description |
|---|---|
| 422 | request body is invalid |
| 401 | invalid or non-existent token |
| 200 | edited |
| 400 | param id is not a number |
| 404 | note not found |
PATCH /notes/:id/review
Send a Authorization Header with format Bearer Token and param id
| param | type | description |
|---|---|---|
| id | number | id from note |
| code | description |
|---|---|
| 401 | invalid or non-existent token |
| 200 | reviesed |
| 400 | param id is not a number |
| 404 | note id not found |
DELETE /notes/:id
Send a Authorization Header with format Bearer Token and param id
| param | type | description |
|---|---|---|
| id | number | id from note |
| code | description |
|---|---|
| 401 | invalid or non-existent token |
| 200 | deleted |
| 400 | param id is not a number |
| 404 | note id not found |
GET /notes
Send a Authorization Header with format Bearer Token.
| code | description |
|---|---|
| 401 | invalid or non-existent token |
| 200 | ok |
If statusCode is 200, the server will respond with an array in this format:
[
{
"id": 1,
"title": "How do vaccines Work",
"content": "Vaccines differ from other medical drugs in two important ways...",
"date: "10/10/2022"
"progress": "0/4"
}
]
GET /notes/today
Send a Authorization Header with format Bearer Token.
| code | description |
|---|---|
| 401 | invalid or non-existent token |
| 200 | ok |
If statusCode is 200, the server will respond with an array in this format:
[
{
"id": 1,
"title": "How do vaccines Work",
"content": "Vaccines differ from other medical drugs in two important ways...",
}
]
Before starting, you will need to have the following tools installed on your machine: Docker.
Besides, it's good to have an editor to work with the code like VSCode.
# First, clone this repository.
$ git clone https://github.com/emilynakano/shining-back.git
# Acces this repository.
$ cd shining-back
# Go to the '.env.example' in your code editor.
ACCESS_TOKEN_SECRET="accesTokenScret"
REFRESH_TOKEN_SECRET="refreshTokenSecret"
# Put your DATABASE_URL, which must be a url. Like this: postgresql://user:password@localhost:5432/name
# Put your POSTGRES_USERNAME, which must be the username from your postgres.
# Put your POSTGRES_PASSWORD, which must be the password from your postgres.
# Put your POSTGRES_DB, which must be the name from your database.
# Put your ACCESS_TOKEN_SECRET, which must be a string.
# Put your REFRESH_TOKEN_SECRET, which must be a string.
# Finally, make a copy of '.env.example' to '.env'.
$ cp .env.example .env
# Install dependencies.
$ npm i -y
# Run the project in the development mode.
$ npm run dev
