Skip to content

celsobenedetti/20-RepoProvas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Document sharing backend app


TypeScript Node.js Express.js

Prisma Postgres Jest

What I Learned

  • Integration tests using Jest
  • How to setup a testing database
  • Seeding with Prisma
  • Factory pattern for tests using Faker

🚀 Routes

  • The default responses are:
    • 200 - Successful GET request
    • 201 - Successful POST request
    • 204 - Successful DELETE request
    • 401 - Auth errors
    • 404 - Resource not found
    • 409 - Resource conflict on POST requests
    • 422 - Body validation error on POST requests

Auth

POST /signup
    - Route for creating a new user
    - body:{
        "email": "jon@doe.com",
        "password": "DonJoe27"
      }
    - response: {"token": "JWT_TOKEN"}
POST /signin
    - Route for signing an existing user
    - body:{
        "email": "jon@doe.com",
        "password": "DonJoe27"
    }
    - Response: {"token": JWT_TOKEN}

Tests

POST /tests
    - Route for creating new tests
    - headers: {"Authorization": "Bearer TOKEN"}
    - body: {
        "name": "Matrixes and vector space",
        "pdfUrl": "https://mywebsite.com/linearAlgebra/firstExam.pdf",
        "categoryId": "1",
        "disciplineId": "5",
        "teacherId": "6",
    }
GET /tests/disciplines
    - Route for finding all tests organized by terms and disciplines
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: array of tests
GET /credentials/teachers
    - Route for finding all tests organized by teachers
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: credential

Releases

No releases published

Packages

No packages published

Languages