There are two available options for you to use this template for your next Back End project: either use Github's built-in Use this api feature (green button left of the 'About' section), or download the zip file and extract it in the root of a new project folder by running these commands:
Then run the following command to install the project's dependencies:
npm install //OBS: you'll need to do this in both folders.
These are the back end commands that you'll need to know:
npm run build // create the project build
npm run start // run the project, not recommended since you'll need also have to change all the import directoriesnpm run dev // recommended way to run the projectnpm run prisma:reset // reset the prisma databasenpm run prisma:migrate // migrate the prisma database, you should do this after the npm installnpm run prisma:prod // starts prisma build production process, do this if you want to make a deploy npm run prisma:test // resets the database in order to make the tests more accuratenpm run prisma:seed // start the seeding process, create data in the databasenpm run test // resets the database in order to make the tests more accuratenpm run test:unit // starts the testing process
These are the front end commands that you'll need to know:
npm run start // starts the project
npm run cypress:open // open cypress
Middlewares
While aiming to provide a reusable, modular and extensible architecture, the middlewares are generally the first structures to be refactored into self-contained modules. The errorHandlerMiddleware(), validateSchemaMiddleware() middlewares were set in order to achieve that goal. The following section describes useMiddleware(), which incorporates the forementioned functions as key–value pairs in an Object, along with their structure and usage.
API Reference
In this section, you will find the example API's endpoints and their respective descriptions, along with the request and response examples, as well as the Prisma models for each entity, that can be used as guide for data formatting. All data is sent and received as JSON.
Models
User model Recommendations
id: A unique identifier for each user. serial4
name: The recommendation title. text An title may only be registered once.
youtubeLink: The recommendations's youtube url. text