You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
3 years ago | |
|---|---|---|
| src | 3 years ago | |
| .env | 3 years ago | |
| .gitignore | 3 years ago | |
| .testing.env | 3 years ago | |
| LICENSE | 3 years ago | |
| README.md | 3 years ago | |
| package.json | 3 years ago | |
| tsconfig.json | 3 years ago | |
| yarn.lock | 3 years ago | |
README.md
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?
git clone https://github.com/jasonfoknxu/restful-api-typescript-express-templateto download the source codeyarnornpm installto install all the dependencies- Edit the config in the
.envfile (.testing.envfor testing) - Add & modify the controllers, models, routes ...
yarn run buildornpm run buildto compile the scripts- (Optional)
yarn run testornpm run testto run the API server with testing config yarn startornpm startto 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