A modern web application backend built with Node.js and Express.
- Node.js (v14 or higher)
- MongoDB
- npm or yarn
- Clone the repository
- Install dependencies:
npm install
- Create a
.envfile in the root directory with the following variables:PORT=3000 MONGODB_URI=mongodb://localhost:27017/ecx-project NODE_ENV=development - Create an
uploadsdirectory in the root folder:mkdir uploads
- Start the development server:
npm run dev
├── src/
│ ├── config/ # Configuration files
│ ├── controllers/ # Route controllers
│ ├── models/ # Database models
│ ├── routes/ # API routes
│ └── index.js # Application entry point
├── uploads/ # File upload directory
├── .env # Environment variables
├── package.json # Project dependencies
└── README.md # Project documentation
npm start: Start the production servernpm run dev: Start the development server with hot reloadnpm test: Run tests
GET /: Welcome message- More endpoints coming soon...
- All major endpoints use Joi validation for request bodies and parameters.
- Centralized error handler returns consistent error responses with proper status codes.
You can add automated tests using Jest and Supertest:
-
Install dev dependencies: npm install --save-dev jest supertest
-
Create a
tests/directory and add test files (e.g., auth.test.js, jobs.test.js). -
Add a test script to your package.json: "test": "jest"
-
Run tests: npm test
ISC