Every generated endpoint follows a consistent routing convention. This makes APIs easy to understand, organize, and extend.
GET /api/v1/bills/showAll
Think of this route like a postal address. Every part has a specific responsibility.
/apiapi tells Express that this URL belongs to the application's REST API.
It separates backend services from frontend pages. Whenever a request starts with /api, Express knows that it should return JSON data instead of rendering HTML.
/v1v1 represents the API version.
Versioning allows new features to be introduced without breaking existing applications. Future releases may provide v2 or v3 while older clients continue using v1.
/tableNameThis block represents the database table (or collection) that the API is working with.
During endpoint generation, the generator automatically replaces tableName with the actual table name.
/api/v1/bills
/api/v1/items
/api/v1/customers
/api/v1/products
/api/v1/orders
If the table is bills, all generated endpoints will begin with:
/api/v1/bills
If the table is items, every endpoint becomes:
/api/v1/items
/showAllThis is the sub-route (endpoint action).
showAll means "return every record available in the selected table."
Since this endpoint only retrieves data, it uses the GET HTTP method.
GET /api/v1/bills/showAll
The server reads every row from the bills table and returns the result as JSON.
[
{
"BillPk": 1,
"CustomerName": "John"
},
{
"BillPk": 2,
"CustomerName": "David"
}
]
GET /api/v1/bills/showAll
│
│
├── api
│ Backend API Root
│
├── v1
│ API Version
│
├── bills
│ Database Table
│
└── showAll
Returns every record
Reading the URL from left to right tells the complete story:
| Sub Route | Purpose |
|---|---|
| showAll | Returns every record from the table. |
| showOne/:id | Returns a single record. |
| insert | Creates a new record. |
| update/:id | Updates an existing record. |
| delete/:id | Deletes a record. |