Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cartory/express-recipes-pagination
The request to the route /recipes returns all the paginated recipes with default values of page and limit.
https://github.com/cartory/express-recipes-pagination
chai express jade mocha nodejs
Last synced: 9 days ago
JSON representation
The request to the route /recipes returns all the paginated recipes with default values of page and limit.
- Host: GitHub
- URL: https://github.com/cartory/express-recipes-pagination
- Owner: cartory
- Created: 2021-12-15T19:52:36.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-17T18:55:29.000Z (almost 3 years ago)
- Last Synced: 2024-10-18T01:45:28.283Z (29 days ago)
- Topics: chai, express, jade, mocha, nodejs
- Language: JavaScript
- Homepage: https://cartory.github.io/Express-Recipes-Pagination/
- Size: 65.4 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Express: Recipes Pagination
The request to the route `/recipes` returns all the paginated recipes with default values of page and limit. The query parameters that can be used to set the pagination criteria are:
- `page:` The page of the resource to be fetched. Defaults to 1. [NUMBER]
- `limit:` The number of items to be returned in a single page. Defaults to 3. [NUMBER]### Routes
- `/recipes?page&limit` - The route to fetch all the recipes from the data-store. Optional query parameters, page and limit, help in controlling the number and position of recipes sent back as a response by the server.### Examples
- `/recipes` - a GET request to get all recipes
```json
[{
"id" : 1,
"name": "Crock Pot Roast"
},
{
"id" : 2,
"name": "Roasted Asparagus"
},
{
"id" : 3,
"name": "Curried Lentils and Rice"
}
]
```- `/recipes?page=1&limit=2`
```json
[{
"id" : 1,
"name": "Crock Pot Roast"
},
{
"id" : 2,
"name": "Roasted Asparagus"
}
]
```- `/recipes?page=2&limit=3`
```json
[ {
"id" : 4,
"name": "Big Night Pizza"
},
{
"id" : 5,
"name": "Cranberry and Apple Stuffed Acorn Squash Recipe"
},
{
"id" : 6,
"name": "Mic's Yorkshire Puds"
}
]
```### Project Specifications
**Read-Only Paths**
- test
- bin
- recipes.json**Commands**
- run: `npm start`
- install: `npm install`
- test: `npm test`