This is a basic Express application template designed to help you create APIs quickly. It includes essential configurations and setup for starting an Express server.
- Basic Express server setup
- CORS enabled
- Environment configuration with
.env
support
Ensure you have Node.js and npm installed on your machine. You can download them from Node.js official website.
- Clone the repository:
git clone https://github.com/mariogiron/express-init-template.git project-name
- Navigate to the project directory:
cd project-name
- Install the dependencies:
npm install
Create a .env
file in the root of the project and configure your environment variables. An example .env
file might look like this:
PORT=3000
Start the server by running:
npm start
The server will start and listen on the port defined in your .env
file, or default to port 3000 if not specified.
To start the server in development mode with nodemon
, which will automatically restart the server on file changes, run:
npm run dev
- start: Runs
node index.js
to start the server. - dev: Runs
nodemon index.js
to start the server in development mode with automatic restarts on file changes.
├── src
│ ├── app.js # Express app configuration
│ ├── models # Data models
│ ├── controllers # Route controllers
│ ├── routes # Application routes
├── .env # Environment variables
├── index.js # Server creation and configuration
├── package.json # Project metadata and dependencies
Feel free to submit issues and pull requests to improve the project. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the ISC License - see the LICENSE file for details.