A basic starter for an Express.js API with TypeScript.
Before you begin, ensure that you have Node.js and npm (Node Package Manager) installed on your machine.
- Clone the repository:
git clone https://github.com/bakiwebdev/express-js-starter.git
- Navigate to the project directory:
cd express-js-starter
- Install the dependencies:
npm install
The following npm scripts are available:
start
: Builds and runs the production version of the API.dev
: Runs the API in development mode usingnodemon
, which automatically restarts the server when changes are detected.build
: Lints the code and compiles TypeScript into JavaScript.lint
: Lints the code using ESLint with the Airbnb TypeScript style guide.test
: Runs the test suite using Jest.
To execute a script, run the following command:
npm run <script-name>
The configuration for the Express API can be modified through environment variables. Create a .env
file in the project root directory and add your configuration variables there. Here's an example:
PORT=3000
├── dist/ # Compiled JavaScript files
├── src/ # Source code
│ ├── api/ # Request handlers
│ ├── interfaces/ # Type Interface
│ ├── middlewares.ts # Middleware functions
│ ├── app.ts # Express application setup
│ └── index.ts # Entry point
├── .eslintrc # ESLint configuration
├── .gitignore # Git ignore rules
├── package.json # Project metadata and dependencies
└── tsconfig.json # TypeScript configuration
- cors: ^2.8.5
- dotenv: ^16.3.0
- express: ^4.18.2
- helmet: ^6.2.0
- morgan: ^1.10.0
This project is licensed under the MIT License. See the LICENSE file for more information.
- Repository: express-js-starter
- Issue Tracker: express-js-starter Issues
- Documentation: express-js-starter Readme