Repoprovas
📋
Description
RepoProvas API, a system for sharing tests between students, built with Typescript, Node.js, Express, Prisma and Postgres.
💻
Features
- Register a new user;
- Login a user;
- Add a new test;
- View tests by disciplines;
- View tests by teachers.
🚀
Routes
Register a new user
POST /signup
Request:
Body | Type | Description |
---|---|---|
email |
string |
Required. User mail. |
password |
string |
Required. User password. |
repeatPassword |
string |
Required. Repeat user password. |
Login a user
POST /signin
Request:
Body | Type | Description |
---|---|---|
email |
string |
Required. User mail. |
password |
string |
Required. User password. |
Response:
{
"token": 11111111111
}
Add a new test
POST /tests
Request:
Headers | Type | Description |
---|---|---|
Authorization |
string |
Required. User token. |
The Authorization field must have the following format: Bearer ${token}
Body | Type | Description |
---|---|---|
name |
string |
Required. Test name. |
pdfUrl |
string |
Required. Valid pdf url. |
categoryName |
string |
Required. Category name. |
disciplineName |
string |
Required. Discipline name. |
teacherName |
string |
Required. Teacher name. |
View tests by discipline
GET /tests/disciplines
Request:
Headers | Type | Description |
---|---|---|
Authorization |
string |
Required. User token. |
The Authorization field must have the following format: Bearer ${token}
Response
[
{
"id": 1,
"number": 1,
"disciplines": [
{
"id": 1,
"name": "Discipline name",
"categories": [
{
"id": 1,
"name": "Category name",
"tests": [
{
"id": 1,
"name": "Test name",
"pdfUrl": "https://...",
"teacher": {
"id": 1,
"name": "Teacher name",
}
}
]
}
]
}
]
},
{
...
}
]
View tests by teacher
GET /tests/teachers
Request:
Headers | Type | Description |
---|---|---|
Authorization |
string |
Required. User token. |
The Authorization field must have the following format: Bearer ${token}
Response
[
{
"id": 1,
"name": "Teacher name",
"categories": [
{
"id": 1,
"name": "Category name",
"tests": [
{
"id": 1,
"name": "Test name",
"pdfUrl": "https://...",
"discipline": {
"id": 1,
"name": "Discipline name",
}
}
]
}
]
},
{
...
}
]
Environment Variables
To run this project, you will need to add the following environment variables to your .env file
PORT = number
Recommended:5000
DATABASE_URL = postgres://UserName:Password@Hostname:5432/DatabaseName
JWT_SECRET = any string
🏁
Run Locally
Clone the project
git clone https://github.com/lugablima/projeto20-repoprovas
Go to the project directory
cd projeto20-repoprovas/
Install dependencies
npm install
Start the server
npm run dev
The API deploy link is: https://back-projeto20-repoprovas.herokuapp.com/