How to create query parameters in URL using Express and Angular?

Viewed 34

So i'm trying to paginate some data coming in as a POST request. (Using POST because the data is large and exceeds GET limits). What im thinking I need to do is get the page number were on currently so whenever a user wants to view a particular page, so we can know which page to present. What I don't understand is how to set up the URL to have parameters within the URL. What i'm hoping to achieve is to have a URL like this https://stackabuse.com/sessions/?page=2&limit=3 but what i currently have is https://stackabuse.com/sessions/

app.post('/newdatasessions', checkAuth, cacheMiddleware(15*60), (req, res) => {

if(req.query.limit == 2 && req.query.page == 1 && req.query.order == 'session_uuid DESC'){
        res.send(values.slice(0,2));
    }
    else{
        res.send([values[values.length-1]]);
    }
}) 
0 Answers
Related