我正在尝试开发一个可存储用户名,国家和用户消息sin mongodb的留言簿应用程序,连接正常,我可以在数据库中提交这3个信息(用户名,国家和消息)。我的问题是将消息发送到“ guestbook.ejs”页面。
如果有人能给我有关我遇到的问题的线索,我将不胜感激。
SyntaxError: Unexpected token return in /Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/views/pages/guestbook.ejs while compiling ejs
If the above error is not helpful, you may want to try EJS-Lint:
https://github.com/RyanZim/EJS-Lint
at Object.Function (<anonymous>)
at Object.Template.compile (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/ejs/lib/ejs.js:524:12)
at Object.compile (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/ejs/lib/ejs.js:338:16)
at handleCache (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/ejs/lib/ejs.js:181:18)
at tryHandleCache (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/ejs/lib/ejs.js:203:14)
at View.exports.renderFile [as engine] (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/ejs/lib/ejs.js:412:10)
at View.render (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/express/lib/view.js:126:8)
at tryRender (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/express/lib/application.js:639:10)
at EventEmitter.render (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/express/lib/application.js:591:3)
at ServerResponse.render (/Users/mesfint/Desktop/MEAN_DEV'T/Guestbook-application/node_modules/express/lib/response.js:960:7)
Run Code Online (Sandbox Code Playgroud)
guestbook.ejs
<!DOCTYPE html>
<html lang="en">
<head>
<% include ../partials/head %>
</head>
<body class="container">
<header>
<% include ../partials/header %>
</header>
<main>
<div …Run Code Online (Sandbox Code Playgroud)