Skip to content

Latest commit

 

History

History
93 lines (74 loc) · 2.43 KB

README.md

File metadata and controls

93 lines (74 loc) · 2.43 KB

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