Skip to content

ademtonay/clean-express-api-architecture

Repository files navigation

Express REST API

Node.js TypeScript Express.js License

Clean class based Node / Typescript REST API Architecture. An ideal template for those who want to get rid of the hassle and start developing directly.

Table of Contents

Features

  • Control your controllers from a single point.
  • Manage settings such as CORS and static folders centrally.
  • Easy to implement it.

Technologies used

  • Typescript
  • Express.js

Getting Started

Prerequisites

  • Node.js (16.x)

Setup

  1. Clone the repository.
git clone https://github.com/mariocoski/rest-api-node-typescript.git
  1. Install dependencies.
npm install or yarn
  1. Configure your environment variables in config file.
{
	"server": {
		"env": "development",
		"port": 3000,
		// enable if application has static file(s)
		//"staticFolders": ["folderName2", "folderName2"],
		"cors": {
			"origins": null,
			"methods": null,
			"allowedHeaders": null,
			"exposedHeaders": null,
			"credentials": null,
			"maxAge": null,
			"preflightContinue": null,
			"optionsSuccessStatus": null
		}
	}
}
  1. Build your api.
npm run build or yarn build
  1. Start your api.
npm run start or yarn start

Development

npm run dev or yarn dev

Endpoints

For check is api working.

http://localhost:3000/health

Result:

{
	"success": true,
	"code": "API_IS_WORKING",
	"message": "Api is working."
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Node + Express + TypeScript Clean Rest Api Architecture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published