A very simple RESTful API Template for testing and demonstration. Basic structure only.
- 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
- 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
git clone https://github.com/jasonfoknxu/restful-api-typescript-express-template
to download the source codeyarn
ornpm install
to install all the dependencies- Edit the config in the
.env
file (.testing.env
for testing) - Add & modify the controllers, models, routes ...
yarn run build
ornpm run build
to compile the scripts- (Optional)
yarn run test
ornpm run test
to run the API server with testing config yarn start
ornpm start
to start the API server
.
├── 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