Member-only story

How to make REST API’s using Node.js, Express.js & Typescript Decorators | Part-1

Rahul Sharma (DevsMitra)
4 min readJan 9, 2020

--

Decorators Introduction:

A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter.

REST API’s using Node.js, Express.js & Typescript Decorators | 6Questions

We’ll be using Method Decorators to develop routesDecorator.

Method Decorators:

A Method Decorator is declared just before a method declaration. The decorator is applied to the Property Descriptor for the method and can be used to observe, modify, or replace a method definition. A method decorator cannot be used in a declaration file, on overload, or in any other ambient context (such as in a declare class).

Definition referred from typescript official site, Check more details about Method Decorators here

Decorators use the form @expression, where expression must evaluate to a function that will be called at run-time with information about the decorated declaration.

NOTE: Decorators are an experimental feature that may change in future releases.

Prerequisite:

  1. Make sure you have installed the latest Node.js ( Download link )
  2. Basic knowledge of javascript, typescript, node.js, and express.js

--

--

Rahul Sharma (DevsMitra)
Rahul Sharma (DevsMitra)

Written by Rahul Sharma (DevsMitra)

I’m a technology enthusiast who does web development. Passionate to contribute to open-source projects and make cool products.

Responses (2)