Giter VIP home page Giter VIP logo

express-typescript-starter's Introduction

A repository to kick-start a Node.js API server project using Express and Typescript.

The purpose of this repository is to become a multi-template to offer a kick-start for a REST API project, having the option to choose from having multiple ORMs / packages / libraries from a little CLI application.

node-express-typescript-starter

This is a starter Node.js API server project built on Express. It uses Typescript and is configured to use ESLint for linting and Jest for testing.

Recommended tools

Getting started

  • Clone the repository
git clone https://github.com/sebi75/express-typescript-starter.git <project_name>
  • Install dependencies
cd <project_name>
npm install
  • Run local development server
npm run dev
  • Use any REST client to test the API
GET http://localhost:8080/hello
  • To run tests
npm test

ENV variables

This project uses [dotenv] To add a new variable, add it to the .env file and use it in the code as process.env.<variable_name> Copy all the contents from .env.example to .env and update the values as needed.

Logging

This project uses Winston for logging. Winston is exported as a logger and can be used to log custom messages on demand. Also, it can be extended to push logs to files, external database, or any logging service.

All of these logs are written to console during development. Feel free to add production-specific loggers as and when needed.

Project structure

-express-typescript-starter
├─ .gitignore
├─ README.md
├─ .env
├─ .env.example
├─ tsconfig.json
├─ package-lock.json
├─ package.json
├─ src
│  ├─ common
│  │  ├─ http-exception.ts
│  │  └─ logger.ts
│  ├─ controllers
│  │  └─ articles.controller.ts
│  │
│  ├─ controllers
│  │  ├─ helloController
│  │      ├─ hello.controller.ts
│  │      ├─ index.ts
│  │      ├─ HelloRequest.ts
│  │      └─zodRequestValidator.ts
│  │
│  ├─ types
│  │  ├─ index.ts
│  │  ├─ ErrorsEnum.ts
│  │  └─ StatusCodes.ts
│  │
│  ├─ utils
│  │  ├─ logger.ts
│  │  └─ requestValidationMiddleware.ts
│  │
│  ├─ routers
│  │  └─ helloRouter.ts
│  ├─ services
│  │   └─ db.service.ts
│  │   └─ debug.service.ts
│  │
│  ├─ app.ts

express-typescript-starter's People

Contributors

sebi75 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.