This is an employee service REST API implementation exampleusing NestJS, Prisma and Sqlite.
- The service will run on port 3000.
- Swagger is available at http://localhost:3000/api
This is a simple example of how to use NestJS, Prisma and Postgres or SQLite. It is not a production ready application.
Make sure you have postgres installed and running on your machine.
Create postgres database with name employee
and user employee
and the password password
.
$ psql -U postgres
postgres=# CREATE DATABASE employee;
postgres=# \q
Create a .env
file with the following content:
DATABASE_URL="postgresql://postgres@localhost:5432/employee?schema=public"
$ yarn install
Prisma client should be generated by the install, but if you run in any prisma client related error, run the following command:
$ npx prisma generate
$ yarn prisma:migrate
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
- Author - Ann Tokalov
- Website - https://anttdev.com
Nest is MIT licensed.