I have the following code that returns data (it requires user auth detail & product Id as part of the request). I want to add caching to enable a quicker response time. In order to enable caching, should it be a GET request, bearing in mind that I am transmitting tokens to authenticate and don't like the idea of passing tokens in URL. Happy to leave as POST but read somewhere that Post request should not be used for caching, hence the confusion.

ProductRoute.post('/data', userAuth, (req, res) => {

var productId = req.body.productId;

if (!validate.STRING(productId)) {
} else {

        productId: productId
    }).then(dbRes => {

        if (dbRes !== null) {
                assetImages: dbRes.assetImages,             
                productStatus: dbRes.productStatus,
                createdDate: dbRes.createdDate,
                title: dbRes.title,
                details: dbRes.details,
                features: dbRes.features,
        } else {




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.