Skip to main content

Sample endpoints documentation

All Boiler Room boilerplates come with two sample endpoints for demonstration purposes.

If you are using a full-stack Boiler Room boilerplate you can interact with these two sample endpoints directly from the client. Simply start your application and navigate to http://localhost:3000/sample.

If you are using an API Boiler Room boilerplate you can interact with these two sample endpoints using cURL or an API development environment such as Postman or Insomnia.

Note: the documentation below assumes that you are running the server side of your application on port 5000. This is the defalt port all server-side Boiler Room boilerpaltes are configured to use.

Sample endpoint 1#

URL: /api/v1/sample

Method: GET

Success Response:#

Status Code: 200

Content:

{
response: 'Hello from the server!'
}

Call using cURL#

Once your application is running, run the following command in a second terminal window to test sample endpoint 1:

curl http://localhost:5000/api/v1/sample

Sample endpoint 2#

URL: /api/v1/sample

Method: POST

Body:

name: string (required)
age: number (required)

Success Response:#

Status Code: 200

Content:

{
received: true,
name: 'Harry Potter'
age: 25
}

Error Response:#

Status Code: 400

Content:

{
status: 'error',
statusCode: 400,
message: Name is required.
}

Call using cURL#

Once your application is running, run the following command in a second terminal window to test sample endpoint 2:

curl -X POST -H 'Content-Type: application/json' -d '{"name": "Harry Potter", "age": 25}' http://localhost:5000/api/v1/sample

Note: if your Boiler Room boilerplate includes MongoDB you must set up your database connection before this will work.