I'm learning Prisma ORM, so to train I created this rest API that I had seen in this video by Full-Cycle
Here are the technologies used in this project.
- Node.js
- TypeScript
- Express.js
- Prisma
- PostgreSQL
- ts-node-dev
- Github
- Clone the repository
git clone https://github.com/Artur-Poffo/Learning-Prisma-ORM.git
-
Install PostgreSQL in your machine
- Follow the steps in the documentation for your operating system and install
-
Connect your database to the application
- Create a
.env
file on root directory - insert one environment variable:
DATABASE_URL="postgresql://<YOUR USER>:<YOUR PASSWORD>@localhost:5432/postgres?schema=public"
- That's it, in the Prisma schema it calls this environment variable to connect the DB, just replace it with your PostgreSQL user information
- Create a
-
install dependencies.
npm install
on root directory (you need installed node and npm for this)- Run on root directory:
npx prisma migrate dev
-
To run the project.
npm run dev
on root directory
Obs: you will need a program to test the Endpoints, like Insomnia but i recommended the Thunder Client VScode extension
-
/
- GET
- Show a
Welcome!
message
- Show a
- GET
-
/students
- POST
- Adds a new
Student
to DB
- Adds a new
- POST
-
/trails
- POST
- Adds a new
Trail
to DB
- Adds a new
- POST
-
/courses
- POST
- Adds a new
Course
to DB
- Adds a new
- POST
-
/lessons
- POST
- Adds a new
lesson
to DB
- Adds a new
- POST
-
/enrollments
- POST
- Adds a new
enrollment
to DB
- Adds a new
- POST
1.0.0
Artur Poffo
Please follow github and join us! Thanks to visiting me and good coding!