Implement the Service Layer

Layered Architecture·1 min read·Jan 1, 2025

The Service layer is located between the Router layer and the Data Access layer.

It is completely agnostic from any transport mechanism such as HTTP or AMQP, which means that it can receive data from multiple sources and still process it effectively.

It contains the business logic of the application and is responsible for:

  1. Performing application-specific tasks using the parsed and validated data sent by the Router layer according to the defined set of business rules (e.g. generating new session tokens, sending emails, and so on).

  2. Calling the Data Access layer in the case it needs to communicate with an external component, such as a database.

Installing the required packages

Let's start by installing the following packages:

$ npm install --save bcrypt jsonwebtoken

Where:

  • bcrypt is a library used to generate and compare hashes based on the Blowfish cipher.

Unlock the program 🚀

Pay once, own it forever.

€79

30-day money-back guarantee

  • 13 modules
  • 113 lessons with full-code examples
  • 29 projects with commented solutions
  • All future lesson and project updates
  • Lifetime access

By submitting this form, you agree to the Terms & Conditions and Privacy Policy.