I'm using a C++ add-on on my Node.js server. I'm trying to get the decrypt function which I imported from the file to run when the api is hit but the decrypt does nothing. Instead, when I leave the decrypt outside the route as commented, it works exactly as intended.
require('nan')
const { decrypt } = require('./build/Release/decrypt.node')
const express = require('express')
const fileupload = require('express-fileupload')
const app = express()
app.use(fileupload())
// decrypt() works fine here
app.post('/upload', (req, res) => {
decrypt()
res.send({
status: true
})
})
I've also tried importing it inside the body of the route but it didn't help.