Earlier, I was getting all the data
pub async fn fetch_dishes() -> Result<Json<Vec<Dish>>, StatusCode>
Since, I added the following parameters
pub async fn fetch_dishes(Path((_pagenumber, _totalrecords)): Path<(u64, u64)>) -> Result<Json<Vec<Dish>>, StatusCode>
Now, everytime, I need to pass these 2 parameters in url to get some data
[Note: But I always wanted to keep these params, optional]
Expecting: I am interested in fetching all the data by default
http://localhost:3000/dishes [this url not working]
http://localhost:3000/dishes/1/2 [this works]
Here is what my route looks like
.route("/dishes/:_page/:_limit", get(fetch_dishes))
a_b_c_d_e is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.