This is a simple API that register a student data. It was created for the 42 challenge. Please find the
For documentation click this link
You can get the insomnia json here
-
To install first you need to clone this repository:
git clone https://github.com/42sp/full-time-selection-process-wblech
-
Run docker-compose at the root folder:
docker-compose up
-
Wait until you get this message:
🐶 Server running at port 3000
-
The APP will be running at:
http://localhost:3000
- It Create, Read and Delete an Student data, using the http method POST, GET and DELETE.
-
The data is stored in a Postgres Database.
-
The Student data has this struct:
{
"id": "integer",
"name": "string",
"intra_id": "string",
"projects": "string[]"
}
- It Create a User data using the http method POST.
- The data is stored in a Postgres Database.
- The User data has this struct:
{
"id": "integer",
"name": "string",
"email": "string",
"password": "string",
"created_at": "date",
"updated_at": "date"
}
- It uses a JWT authentication and allow a User authenticated to access a
testauth
route.
-
Students route
a) To create a new Student send an http POST method in a json body to
http://localhost:3000/students
b) To read a Student send an http GET method to
http://localhost:3000/students
b.1) This GET method allows query named
project
which brings only Student data that has the project in the project item. Send a GET method tohttp://localhost:3000/students?project=name_project
c) To delete a Student send an http method delete with a id param
http://localhost:3000/students/:id
-
User route
To create a User send an http POST method in a json body to
http://localhost:3000/users
-
Create a JWT token
To create a JWT token send an http POST method in a json body to
http://localhost:3000/sessions
-
Access Test Auth get
To access the auth route, send and http GET method with a header Authorization to
http://localhost:3000/testauth