Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

Foundation of a TypeScript API project using Node.js and Express.

License

Notifications You must be signed in to change notification settings

macajind/typescript-api-project-foundation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foundation of a TypeScript API project using Node.js and Express

Installation

0) Clone

git clone [email protected]:macajind/typescript-api-project-foundation.git

1) Install

npm install

2) Start developing

npm watch # or npm watch-debug

Configuration

  • Change project name, version, licence etc. in the package.json file.

  • Create .env file from the example with the specific configuration for your project.

  • Install any other required libraries for your project using npm and don't forget about theirs TypeScript parts.

Usage

Project uses traditional API architecture with two layers (models and controllers) and JSON format as output. It disposes with powerful, but lightweight implementation of basic annotations known from other frameworks and languages, that can really help you with your project development.

  1. Place your controllers so mapping defined in your .env can find them. And inherit from Controller class to provide them with helpful features.

  2. Use @Inject annotation in your classes on properties and constructors to automatically get instances your services by using design pattern Dependency Injection.

  3. Use @Route annotation for easy mapping of controller methods to specific URLs by using standard Express routing and combine it directly with input data validation through Express validator.