Giter Site home page Giter Site logo

express-sample's Introduction

Sample Express API

This is a sample Express API that can be used as a template for other projects.


Getting Started

Prerequisites

Node.js and npm are required to run this project. You can download them from here.

Installation

Install all dependencies:

npm ci

Run the server:

npm start

This will start the express server on port 3000.

Structure

The entry point of the application is index.ts. This file is responsible for starting the express server and loading all the routes.

The folder controllers contains all the controllers for the routes. Each controller lives in its own folder and contains the following files:

  • [controller].controller.ts - This file contains the controller class that handles the requests.
  • [controller].routes.ts - This file contains the routes for the controller.
  • [controller].models.ts - This file contains the models for the controller.
  • [controller].service.ts - This file contains the service for the controller that handles the business logic.

The folder middlewares contains all the middlewares that can be used in the routes. Some are already implemented and can be used as examples. There are also global middlewares that are used in all routes.

Everything is written with typescript and compiled to javascript. Compiled javascript files are located in the dist folder.

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.