
In this section, we are going to learn the basics of Nodejs and we are going to build the basic web server in nodejs
Learn how Prisma converts models written in its schema language into SQL database tables, defines relationships, and migrates an SQLite database while building a basic application.
Set up a video model in Prisma, link it to courses with a one-to-many relationship, and insert records with the Prisma client in Node.js using a Postgres database.
Configure prisma data sources and database connections (sqlite, sql, mongo) via the .env url, generate types with prisma generate, and define relations using foreign keys.
Learn to implement find by id for courses using prisma's findUnique in a Node.js TypeScript router, including id handling, validation, and error responses (404, 400) with debugging tips.
Explore offset-based and cursor-based pagination in Prisma, with a course data example, including filtering, sorting, and per-page limits, and when to use infinite scrolling for mobile social apps.
Demonstrates using Prisma's transaction API for independent sequential queries, allowing multiple finds (applications, customers, courses) in a single operation, with all-or-nothing rollback on failure.
Master the not to be matcher in tests by using expect statements to invert outcomes; verify that ten plus fifteen equals twenty-five and adjust expectations to pass the test.
Explore promise chaining and the switch to async/await, handling success and errors with then, catch, and try/catch; learn to fetch multiple GitHub users with Promise.all and parse JSON.
Prisma is a next-generation object–relational mapper (ORM) that claims to help developers build faster and make fewer errors. Prisma takes a different approach to ORMs compared to traditional ORMs. It uses a custom Schema Definition Language (SDL) that automatically writes migrations and generates type-safe code.
Why Prisma?
ORMs facilitate implementing the domain model. The domain model is an object model that incorporates the behavior and data of your business logic. In other words, it allows you to focus on real business concepts rather than the database structure or SQL semantics.
ORMs help reduce the amount of code. They save you from writing repetitive SQL statements for common CRUD (Create Read Update Delete) operations and escaping user input to prevent vulnerabilities such as SQL injections.
ORMs require you to write little to no SQL (depending on your complexity you may still need to write the odd raw query). This is beneficial for developers who are not familiar with SQL but still want to work with a database.
Many ORMs abstract database-specific details. In theory, this means that an ORM can make changing from one database to another easier. It should be noted that in practice applications rarely change the database they use.
In this course, we are going to build the REST API in Prisma, Node, Express, and Postgres