A simple yet powerful RESTful API for a task management application, built with Node.js and Express. This project includes a comprehensive test suite using Jest to ensure code quality and reliability.
- Full CRUD Functionality: Create, Read, Update, and Delete tasks.
- RESTful API: Clean, predictable, and well-structured API endpoints.
- Comprehensive Test Suite: Includes unit, integration, and API tests.
- High Test Coverage: Aims for high code coverage to ensure reliability.
- Interactive Frontend: A simple client-side application to interact with the API.
- Node.js (v14 or newer)
- npm (comes with Node.js)
- MongoDB installed and running (for local development).
-
Clone the repository:
git clone [https://github.com/Bipin2004/keyploy-api.git](https://github.com/Bipin2004/keyploy-api.git) cd keyploy-api -
Install dependencies: This command installs both production and development dependencies.
npm install
-
Set up environment variables: Create a
.envfile in the root of the project.PORT=3000 MONGO_URI=mongodb://localhost:27017/taskdb
-
Run the application server:
npm run dev
This project uses Jest for testing and Supertest for API endpoint verification. An in-memory MongoDB server is used to ensure tests are isolated and fast.
Execute the following commands from the project root:
-
Run all tests once:
npm test -
Run tests in watch mode (re-runs on file changes):
npm run test:watch
-
Run tests and generate a coverage report:
npm run test:coverage
This will create a
coveragedirectory. You can view the detailed HTML report by openingcoverage/lcov-report/index.htmlin your browser.
Here is a screenshot of the test coverage achieved for this project. The goal is to ensure all critical logic in the models and API routes is thoroughly tested.
(Action Required: After running npm run test:coverage, take a screenshot of the terminal output or the HTML report and embed it here.)
