Simple RESTful API using TypeScript and Node.js. This API will manage a small database (In memory) of real estate listings, enabling users to add a new listing, retrieve all listings, and delete a listing.
- TypeScript
- Node.js
- Express.js
Interface named Listing with the following properties:
- id: a unique identifier for the listing (string)
- title: the title of the real estate listing (string)
- price: the price of the listing (number)
- description: a brief description of the listing (string)
- Add a New Listing:
- [POST] endpoint
/listings
that allows users to add a new listing. This endpoint accept JSON object with the follow properties:
{ "title": "Property Title", "price": 250000, "description": "Property Description" }
- [POST] endpoint
- Retrieve All Listings:
- [GET] endpoint
/listings
that retrieves all current listings from the in-memory store.
- [GET] endpoint
- Delete a Listing:
- [DELETE] endpoint
/listings/:id
where:id
is the unique identifier of the listing to be deleted. This endpoint should remove the specified listing from the in-memory store.
- [DELETE] endpoint
To start the project you need to have installed Node JS v20 on your machine, you also need to install the project dependencies using the following command: npm install
- Build the project:
npm run build
- Start the project:
npm run start
- Start the project in dev mode:
npm run start:dev
- Run tests:
npm run test
- Run tests in watch mode:
npm run test:watch
- Generate test coverage report (reporters html and lcov):
npm run test:cov
- Generate Open Api Documentation:
npm run generate-types