A single endpoint app built using the Express framework and the Node environment without the use of external libraries.
- Set up Express and Node environment with server listening on port 3000
- Installed necessary dependencies in package.json
- Created dummy data using loops
- Created endpoint, added manual pagination, and incorporated sorting functionality
- Deployed to Heroku
Using queries added onto the "/apps" endpoint allows us to specify which page we would like to view while limiting the number of data entries printed per page. Sort and order query params were added to allow us to organize the displayed data based on the id or name of the app and in an ascending or descending format. The query parameter (req.query) is used over the path parameter (req.param) as it is best practice when sorting or filtering data. If no queries are specified in the URI, built-in default values keep everything running smoothly. A check is also implemented to show the previous and next pages, if available, and how many entries will be shown on those pages.
- Clone the repo
- Install the server dependencies with:
npm install
oryarn install
- Run the local backend server using
npm start
oryarn start
- Open
http://localhost:3000
and start entering your test queries into the URI
Query Parameters | Type | Default | Description |
---|---|---|---|
page | Number |
1 |
Paginates to the requested page. |
limit | Number |
50 |
Limits number of entries per page. |
sortBy | String |
"id" |
Only accepts "id" or "name". |
orderBy | String |
"asc" |
Enter 'asc' for ascending order or 'desc' for descending order. |
- JavaScript - Front End
- Express.js - Backend
- Node.js - Backend