I worked on the integration of Prisma 2 with the Ts.ED Framework, and I was impressed by the work carried out by the Prisma’s team on its ORM and its development tools.

This is the opportunity for me to do a tutorial for developers wishing to create a REST application with Prisma 2 and Ts.ED. So in this story, we’ll see the following points:

  • Create Ts.ED application with the Ts.ED CLI
  • Generate initial Prisma configuration
  • Expose a Rest API using Prisma and Ts.ED

Prisma.io

Prisma is an open-source ORM for Node.js and TypeScript.

It is used as an alternative to writing plain SQL, or using another database access tool such as SQL query builders (like knex.js) or ORMs (like  TypeORM and  Sequelize).

Prisma currently supports PostgreSQL, MySQL, SQL Server and SQLite.

Ts.ED

Ts.ED is a Node.js Framework on top of Express/Koa.js. Written in Typescript, it helps you build your server-side application easily and quickly. If you want to start a complete out-of-the-box project or fully customize it yourself, Ts.ED will guide you there!

Step 1: Start a new Ts.ED application

Generate a new Ts.ED application can be done by using the Ts.ED CLI:

npm install -g @tsed/cli
tsed init tsed-prisma

For this tutorial, we’ll use Express and Swagger presets from the CLI. You can also add JestEslint and Prettier! You should have the following presets configuration in the CLI prompt:

Ts.ED CLI create project options

Ts.ED CLI

Note: You can choose your favorite package manager for this tutorial :)

#typescript #nodejs #expressjs #tsed #node

Bootstrap A Node.js Rest API with Ts.ED and Prisma 2
1.50 GEEK