Skip to content

nda17/Node-express-server

Repository files navigation

«Node-express-server»

Implementation features:

Node.js server with implementation using the Express.js framework. Interaction with the Postgres database is carried out through Prisma (ORM).

The project implements the "Publication" entity.

The following queries were created:

  • [GET] Request to get all "Publication" entities from the database

  • [GET] Request to obtain a specific entity from the database by its "id"

  • [CREATE] Request to create the entity "Publication" in the database with the properties "id", "createdAt", "updatedAt", "title", "description"

  • [PUT] Request to update entity properties by "id" in the database

  • [DELETE] Request to delete an entity by "id" from the database


Testing:

Added unit tests (Jest) for testing CREATE and PUT requests


Used stack:

  • [V] Express.js
  • [V] Typescript
  • [V] Ts-node-dev
  • [V] Prisma
  • [V] Helmet
  • [V] Morgan
  • [V] Zod
  • [V] Dotenv
  • [V] Compression
  • [V] Jest
  • [V] Supertest

Database:

  • [V] PostgreSQL

Adding personal settings to the .env environment variable:

  • PORT = 4200

DEVELOPMENT mode or PRODUCTION mode (select one mode):

  • NODE_ENV = production
  • NODE_ENV = development

Path to database:

  • DATABASE_URL = postgresql://postgres:postgres@localhost:5432/blog?schema=public

Compiles and minifies for production:

  • pnpm run build
  • npm run build

Getting started online development server:

  • pnpm run dev
  • npm run dev

Running unit tests:

  • pnpm run test
  • npm run test