J
J
jenya77712017-08-20 11:42:54
Node.js
jenya7771, 2017-08-20 11:42:54

How to transfer the connected library to the exports module?

Hello, There are 2 files, one is in the main one to which all libraries are connected, and there is a file with a separately rendered module, how can I transfer the library to the rendered module?

var express = require('express');
var bodyParser = require('body-parser');
var jwt = require('jsonwebtoken');
var app = express();

module.exports = function(app, jwt) {
  app.post('/decode', (req, res) => {

    var token = req.body.token;

    var decoded = jwt.decode(token, {complete: true});
    
    console.log(decoded.header);
    console.log(decoded.payload);
    res.json({
      header: decoded.header,
      payload: decoded.payload
    });

  });

};

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question