It is a scalable API that handles CRUD requests out of the box. However, with the help of a recursive algorithm baked inside, it is becoming very easy to design deeply nested subdomains with their own custom handlers.
- Clone this repo
bash npm i && npm run start
Endpoint | Method | Description |
---|---|---|
/api/users |
GET | Retrieves all user records. Returns a status code of 200 and the user records. |
/api/users/{userId} |
GET | Retrieves a specific user record by ID. Returns a status code of 200 and the user record if found, or a status code of 400 if the ID is invalid or 404 if the record doesn't exist. |
/api/users |
POST | Creates a new user record. Returns a status code of 201 and the newly created record. Server will answer with status code 400 and corresponding message if request body does not contain required fields |
/api/users/{userId} |
PUT | Updates an existing user record. Returns a status code of 200 and the updated record. However server will answer with the |
/api/users/{userId} |
DELETE | Deletes an existing user record. Returns a status code of 204 if the record is found and deleted. |
-
Users are stored as objects with properties:
- id: unique identifier (string, uuid) generated on the server side
- username: user's name (string, required)
- age: user's age (number, required)
- hobbies: user's hobbies (array of strings or empty array, required)
-
Requests to non-existing endpoints are handled with a status code of 404 and a corresponding human-friendly message.
-
Errors on the server-side are handled with a status code of 500 and a corresponding human-friendly message.