The question is how to write a nodejs (commonJS) module in Typescript? I have a node.js module like this :
var testController = require("/controllers/test").
app.get('/testTS', testController.getUsers);
In test.js file, I have
exports.getUsers = function(req,res) {}.
If I have to convert my test.js file to Typescript, how would I proceed? I am compiling with commonjs module. Here is the file I tried :
module user {
export class getUsers {
constructor(req:any, res:any) {}
}
}
module.exports = user;
If I convert this file to JS, there are no callbacks of type
exports.getUsers = function(req,res);
If I say like
var testController = require("/controllers/test").
testController.getUsers() => this works. but I cannot specify this in
app.get('testTS', testController.getUsers());
Can someone help me to write the callbacks like this in Typescript?