I'm trying to make a page that will have a form written Name and Comment, in which when the person fill in the name and the comment will appear underneath the formular.Só que ta giving error. Below this my file EJS and Just below the server file along with Mongo, the routes
<!DOCTYPE html>
<html>
<head>
<title>X-Sports</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/css/quemsomoss.css">
</head>
<body>
<nav id="men">
<ul>
<li><picture><img class="pho" src="http://i.imgur.com/rjtgdhD.png"></picture></li><li><ahref="/Paginajava">Home</a></li>
<li><a href="/quemsomos">Quem somos?</a></li>
<li><a href="/Produtos">Produtos</a></li>
<li><a href="/faleconosco">Fale Conosco</a></li>
<li><form>
<input type="search" placeholder="Buscar">
</form></li>
</ul>
</nav>
<section>
<br>
<br>
<br>
<div class="tab">
<h1>Comentários</h1>
<form action="/quemsomos" method ='post'>
Nome:<input type:"text" name="Nome">
Comentarios:<input type='text' name="Coment"><br>
<input type="submit" value="Cadastrar">
</form>
<table>
<% for(var i=0; i<resultado.length; i++){ %>
<tr>
<td><%= resultado[i].Nome %></td>
<td><%= resultado[i].Comentarios %></td>
</tr>
<%}%>
</table>
</div>
</section>
</body>
</html>
And here is that of my server, along with Mongo
var http = require('http'); var express = require("express"); require("ejs"); var bodyparser = require('body-parser'); var mongoose = require("mongoose"); var app = express(); var Post = mongoose.Schema({ Nome: "String", Comentários: "String", }); var Coment = mongoose.model('Coment', Post); var mongo = mongoose.connect('mongodb://localhost/Comentarios'); app.use(express.static('./public')); app.use(express.static('./app/views')); app.set('views' , './app/views'); app.set('view engine','ejs'); app.use(bodyparser()); app.get('/', function(req, res) { res.render('Paginajava'); }); app.get('/Paginajava', function(req, res) { res.render('Paginajava'); }); app.get('/quemsomos', function(req, res) { res.render('quemsomos'); }); app.post('/quemsomos', function(req,res){ var novoPost = new Coment( { Nome: req.body.Nome, comentarios:req.body.comentarios, } ); novoPost.save(); resp.render("quemsomos"); resp.end(); }); app.get("/quemsomos", function(req, resp){ Coment.find(function(err, resultado){ resp.render("quemsomos", { resultado: resultado} ); resp.end(); }); }); app.get('/produtos', function(req, res) { res.render('Produtos'); }); app.get('/faleconosco', function(req, res) { res.render('faleconosco'); }); var meuServidor=http.createServer(app); meuServidor.listen(8080); console.log("Servidor Rodando" );