Skip to content

jasonfoknxu/restful-api-typescript-express-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful API Template (TypeScript + Express)

A very simple RESTful API Template for testing and demonstration. Basic structure only.

⚠️ This template is NOT ready for production use! ⚠️

📓 Notices & Limitations

  • Database connection is NOT implemented in this template
  • The auth controller is NOT a complete solution ❗
  • Routes, controllers and models should be added to the API
  • Delete the user route & auth controller if you don't need them

📋 Features

  • TypeScript, ES2020 version
  • Build with Express
  • Gzip Compression
  • Basic XSS Protection
  • CORS-enabled (All Origins)
  • Ready to support JSON Web Tokens (JWT)
  • Support JSON Request
  • Support SSL (HTTPS server)
  • Support Config file

📝 How to use?

  1. git clone https://github.com/jasonfoknxu/restful-api-typescript-express-template to download the source code
  2. yarn or npm install to install all the dependencies
  3. Edit the config in the .env file (.testing.env for testing)
  4. Add & modify the controllers, models, routes ...
  5. yarn run build or npm run build to compile the scripts
  6. (Optional) yarn run test or npm run test to run the API server with testing config
  7. yarn start or npm start to start the API server

📁 File Structure

.
├── dist                # The compiled scripts
├── node_modules        # The dependencies and the libraries
├── src                 # Directory of the source code
│   ├── controllers     # Directory for the controllers of the API
│   ├── middleware      # Directory for the middleware of the API
│   ├── models          # Directory for data models, database structure
│   ├── routes          # Directory for the API routes
│   ├── types           # The types and interface of TypeScript
│   └── utils           # The utilities used in the API
├── .env                # The config file of the API
├── .testing.env        # The testing config
├── package.json        # The Node.js ecosystem file
└── tsconfig.json       # Config of TypeScript

🔖 Credits

Releases

No releases published

Packages

No packages published