Skip to content

erdemkosk/typescript-express-boilerplate

Repository files navigation

Logo

typescript-express-boilerplate

This is boilerplate for typescript & express and dependcy injection

Acknowledgements

Features

  • Custom Error support. You can create any custom error with message,code,httpCode like throw new CustomError()
  • Dependcy Injection for all modules

Tech Stack

Node, Express, Typescript, tsyringe

API Reference

Throwing Error Demo

  GET /error
Parameter Type Description
- - You will see uncustom error handler {"message":"Internal server error","success":false}

Throwing Custom Error Demo

  GET /custom-error
Parameter Type Description
- - You will see custom error handler {"message":"Example Error For Test","errorCode":1,"success":false}

Testing endpoint

  GET /foos
Parameter Type Description
- - You will see custom error handler {"message":"Example Error For Test","errorCode":1,"success":false}

Run Locally

Clone the project

  git clone https://github.com/erdemkosk/typescript-express-boilerplate.git

Go to the project directory

  cd typescript-express-boilerplate

Install dependencies

  npm install

Start the server

  npm run dev

Docker

Create a Docker image

  docker build -t typescript-express-boilerplate .   

Run a Docker image

  docker run -p 8080:8080 typescript-express-boilerplate    

Contributing

Contributions are always welcome!

License

MIT

About

This is boilerplate for typescript & express and dependcy injection.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published