EDIT:
@baris error is gone / fixed. Thank you!
Template hello.tpl:
<html>
<body>
<div>hello {message}</div>
<body>
<html>
The code in the controller is res.render('user/hello.tpl', req.query);
. The response I got back is a json instead of a html page:
{
"message": "world",
"loggedIn": true,
"relative_path": "",
"template": {
"name": "user/hello.tpl",
"user/hello.tpl": true
},
"url": "/hello",
"bodyClass": "page-hello"
}
What have I miss? Please advise, thanks!
The NodeBB middleware automatically sets the response type to JSON for any route beginning with api
Set the begining of the route to anything other than api
and it should work.
Alternatively, I think setting
res.locals.isAPI = false
before you render would also work.
@Bruce-Lee first, remove the .tpl
from the route.