nodejs-hotel-problem — README.md
Professional experience
- Document type
- Public repository documentation snapshot
- Purpose
- Supports bounded professional information and project references.
- Stable document identifier
repository-nodejs-hotel-problem-readme-md- Source origin
- Allowlisted public documentation pinned to a verified public commit. Reported tests, performance and deployment statements have not been independently reproduced by this corpus.
- Repository source file
content/portfolio/published-synchronization.json- Authorship
- Unknown — human or AI authorship has not been established.
- Review / publication
- Publication approval recorded.
- Publication terms
- Public display requires record-level publication approval; original source copyright and license remain applicable.
- Review date
- 2026-10-29T05:02:45.301Z
- Canonical English content revision
- Not established by a source history.
- Repository source commit
bc5a837f34298a96e3104ea1d27fedca0ddfe811- Repository commit date (not a document editorial date)
- Source content fingerprint
e418809fa41e451d55eadfe368076df2bfc1cde28144ce1177265c506344d700- Ingestion observation
source-887baf6c60d0ef67
Document content
Reviewed public source snapshot.
nodejs-hotel-problem: public repository documentation snapshot. Statements below are repository-reported, not independently reproduced test, performance, production or business outcomes. # Hotel Booking Constraint API
A **historical 2019 interview exercise** in Node.js/Express: allocate guests to rooms using a small rule parser, with controller tests for accepted and rejected bookings. This repository demonstrates an earlier approach to business-rule modeling; it has not been modernized or assessed as a production booking service.
[Current engineering portfolio](https://mohd.paramasvara.online/en/) · [Professional work and contact](https://mohd.paramasvara.online/en/work-with-me/)
## Problem and constraints
The API accepts guest counts under `bookings` and returns room assignments or an `error` array. The original rule definitions and allocation branches are in [`ApiController.js`](src/controllers/ApiController.js):
- Guest categories are `adult`, `children` and `infant`. - The booking-wide capacity check counts adults and children together, with a maximum of seven; infants are excluded from that count. - Room rules set a maximum of three for each category. Children and infants require an accompanying adult. - The implementation distributes adults across rooms and handles minors in separate allocation branches. This is a specific exercise implementation, not a general allocation solver or a guarantee that every input ordering and boundary works.
These describe the checked-in rules, not a newly recovered or expanded interview specification.
## API examples
[`routes/index.js`](src/routes/index.js) defines `GET /api` and `POST /api/booking`. The health response is `{"message":"API Endpoint"}`.
Example request to `POST http://localhost:3000/api/booking`:
Response:
Over-capacity request:
Response:
The original README showed that second request as a success. It exceeds the implemented non-infant capacity and has been corrected here. The o
Content hash: 71a22f8e216c90f71cd7a02ebbb3314eda1ff6afd5bcd5ece6bd6bb946cb1629