const express = require('express');
const dotenv = require('dotenv')
const morgan = require('morgan')
const bodyparser = require('body-parser')
const path = require('path');

const app = express();
dotenv.config({path: 'config.env'})

const PORT = process.env.PORT || 8000

app.set("view engine","ejs")

app.get('/', function(res, req, next) {
  res.render('index');                       //server.js:30:9
})
app.listen(4000);

TypeError: res.render is not a function at F:\MERN Training\CodePractice\ReactJs\MyPractice\CrudApplication\server.js:30:9 at Layer.handle [as handle_request] (F:\MERN Training\node_modules\express\lib\router\layer.js:95:5) at next (F:\MERN Training\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (F:\MERN Training\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (F:\MERN Training\node_modules\express\lib\router\layer.js:95:5) at F:\MERN Training\node_modules\express\lib\router\index.js:281:22 at Function.process_params (F:\MERN Training\node_modules\express\lib\router \index.js:341:12) at next (F:\MERN Training\node_modules\express\lib\router\index.js:275:10) at urlencodedParser (F:\MERN Training\node_modules\body-parser\lib\types\urlencoded.js:91:7) at Layer.handle [as handle_request] (F:\MERN Training\node_modules\express\lib\router \layer.js:95:5)

1

There are 1 answers

0
misugi On

You should write function(req, res, next), NOT function(res, req, next). Function render does not exists in Request parameter.