I'm trying to output a "hello world" text . I'm using expressjs and using view engine called "ejs" . i'm a beginner in nodeJS
var express = require("express");
var app = express();
var path = require('path');
var res = require("res");
var port = process.env.PORT;
app.set('view engine');
app.set('views',path.resolve(__dirname,'client','views'));
app.get('/',function() {
res.render('index.ejs');
});
app.listen(port,function(){
console.log('Server running in PORT '+port);
});
Here is the error:
module.js:338
throw err;
^
Error: Cannot find module 'res'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/home/ubuntu/workspace/server.js:4:11)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.runMain [as _onTimeout] (module.js:475:10)
Process exited with code: 1
what is the problem here?