Décrivez ici votre problème ou ce que vous cherchez à faire.

/je veux definir ma route pages/index avec render\

// Routes
app.get('/', (request, response) => {
response.render('pages/index')
})

/je pense peut etre avoir mal ecrit quelque chose je vous transmet le code entier ici\

let express = require('express')
let app = express()
let bodyParser = require('body-parser')
let session = require('express-session')

// Moteur de templates
app.set('view engine', 'ejs')

// Midlleware
app.use('/assets', express.static('public'))
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(session({
secret: 'zqsdzqsdzsd',
resave: false,
saveUninitialized: true,
cookie: { secure: false }
}))

// Routes
app.get('/', (request, response) => {
response.render('pages/index')
})

app.post('/', (request, response) => {
if (request.body.message === undefined || request.body.message === '') {
request.flash('error', "Vous n'avez pas poster de message")
response.redirect('/')
}
})

app.listen(8080)

Ce que j'obtiens
SyntaxError: Unexpected identifier in C:\Users\tom\Documents\LivreOr\views\pages\index.ejs while compiling ejs

If the above error is not helpful, you may want to try EJS-Lint:
https://github.com/RyanZim/EJS-Lint
Or, if you meant to create an async function, pass async: true as an option.
at new Function (<anonymous>)
at Template.compile (C:\Users\tom\Documents\LivreOr\node_modules\ejs\lib\ejs.js:673:12)
at Object.compile (C:\Users\tom\Documents\LivreOr\node_modules\ejs\lib\ejs.js:398:16)
at handleCache (C:\Users\tom\Documents\LivreOr\node_modules\ejs\lib\ejs.js:235:18)
at tryHandleCache (C:\Users\tom\Documents\LivreOr\node_modules\ejs\lib\ejs.js:274:16)
at exports.renderFile [as engine] (C:\Users\tom\Documents\LivreOr\node_modules\ejs\lib\ejs.js:491:10)
at View.render (C:\Users\tom\Documents\LivreOr\node_modules\express\lib\view.js:135:8)
at tryRender (C:\Users\tom\Documents\LivreOr\node_modules\express\lib\application.js:657:10)
at Function.render (C:\Users\tom\Documents\LivreOr\node_modules\express\lib\application.js:609:3)
at ServerResponse.render (C:\Users\tom\Documents\LivreOr\node_modules\express\lib\response.js:1039:7)

Aucune réponse