I am following a tutorial to create a sign up page using Nodejs and Mysql: https://www.js-tutorials.com/javascript-tutorial/node-js-user-authentication-using-mysql-express-js/
But somehow encountered into the issue below which I could not find any solution. Hope you guys can help. Thanks in advance!
Error log
ReferenceError: C:\Users\User\Desktop\nodejstest\nodejsmysql\webapp\views\index.ejs:18
16|
17| <div style="padding-top:30px" class="panel-body" >
>> 18| <% if (message.length > 0) { %>
19| <div class="alert alert-danger col-sm-12"><%= message %></div>
20| <% } %>
21|
message is not defined
Index.js
var express = require('express');
var router = express.Router();
/* GET home page. */
exports.index = function(req,res){
var message = '';
res.render('index',{message: message});
}
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
module.exports = router;
Index.ejs
<div style="padding-top:30px" class="panel-body" >
<% if (message.length > 0) { %>
<div class="alert alert-danger col-sm-12"><%= message %></div>
<% } %>