This project is a boilerplate for building an Express.js application with MVC architecture. It provides a starting point for Node.js backend applications with essential features like environment configuration, testing, and common middleware.
Express.js
: Minimal and flexible Node.js web application framework.Environment Configuration
: Using dotenv to manage environment variables.CORS
: Cross-Origin Resource Sharing enabled via the cors package.Request Logging
: HTTP request logger using morgan.Testing
: Integrated with Jest and Supertest for testing routes and functionality.Linting
- ESLint configured for code quality and consistency.
Before you begin, ensure you have Node.js installed on your local machine.
-
Clone the repository:
git clone https://github.com/marventures/expressjs-mvc-template.git cd expressjs-mvc-template
-
Install dependencies:
npm install
-
Create an Environment File:
cp .env.example .env
-
Start the Development Server:
npm start
NOTE: The server will start at http://localhost:{PORT}.
npm start
- Starts the server with Node.js and watches for file changes.npm test
- Runs the Jest test suite.npm run lint
- Lints the codebase using ESLint.npm run lint:fix
- Automatically fixes linting issues
- GET
/api/test
: Test default endpoint available in the template.
- This project is licensed under the MIT License. See the LICENSE file for details.