Answers for "version control api nodejs best practices"

0

version control api nodejs best practices

//version taken out from header

    app.use(function(req, res, next)
    {
       req.version = req.headers['accept-version'];
       console.log(req.version);
       next();
    });

    //version path defined

    app.use('/api', versionRoutes({  
       "1.0.0": respondV1,
       "2.0.0": respondV2
    }));

    function respondV1(req, res, next)
     {   
        app.use('/api',routeV1);
        next();
     }
    function respondV2(req, res, next)
    {
       app.use('/api',routeV2);
       next();
    }*
Posted by: Guest on July-23-2021

Code answers related to "version control api nodejs best practices"

Code answers related to "Javascript"

Browse Popular Code Answers by Language