Giter Site home page Giter Site logo

node-typescript-boilerplate's Introduction

Daniel Sousa @TutoDS

NodeJS ExpressJS TypeScript MongoDB

Boilerplate

status

Note: Login is implemented, but the middleware to verify if user have session and router protection not finished yet

This repository contains my boilerplate to build an API Rest using NodeJS, TypeScript, ExpressJS and Mongoose (MongoDB).

I built this boilerplate after see some videos and try some times. When I finished all tries and solve some problems, I join all code in this repository to future projects.

This repository is public and I hope is useful to other people.

Folder Structure

In this repository you can find folders shown below:

.
└── src
    ├── configs
    ├── controllers
    ├── exceptions
    ├── middlewares
    ├── models
    │   └── interfaces
    └── routes

The folder src/configs contains all code related with configs, like Mongoose connection.bg-0

Beyond that folders, you can find Babel (babel.config.json) and TypeScript (tsconfig.json) configuration file, as also ESLint (.eslintrc and .eslintignore), Nodemoon (nodemoon.json) and Prettier (.prettierrc) configuration files.

Notes

About TypeScript: in tsconfig.json you can see the configuration I use. I create custom paths to use in all .ts files, this way you not need use relative paths, for example, to configs/ folder, I create @configs path, and to use: import mongoose from '@configs/mongoose'. For me, this is a good functionality in TypeScript and help you to create a clean imports.

Custom Paths - TypeScript

"paths": {
	"@models/*": ["./models/*"],
	"@controllers/*": ["./controllers/*"],
	"@views/*": ["./views/*"],
	"@configs/*": ["./configs/*"],
	"@middlewares/*": ["./middlewares/*"],
	"@exceptions/*": ["./exceptions/*"],
	"@routes/*": ["./routes/*"],
	"@index-routes": ["./routes"]
},

node-typescript-boilerplate's People

Contributors

dependabot[bot] avatar tutods avatar

Stargazers

 avatar  avatar  avatar  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.