I am trying to load my index page, I am using Swig template engine and Express. I get this error:
{
"message": "Failed to lookup view \"/front/index\" in views directory \"/home/ubuntu/workspace/asset-management/server/views\"",
"error": {
"view": {
"defaultEngine": "html",
"ext": ".html",
"name": "/front/index",
"root": "/home/ubuntu/workspace/asset-management/server/views"
}
}
}
But it doesn't make sense unless I am missing something because the file path is this:
/asset-management/server/views/front/index.html
the /views/front/index.html
should be correct based off the error right? What am I missing here? I can get other files to work in directories other than front. I have tried copying the part of the path needed into my route.
Route:
// homepage and dashboard
app.get('/',
setRedirect({auth: '/dashboard'}),
isUnauthenticated,
setRender('/front/index'),
main.getHome);
Ignore the most of the middleware and look at the setRender
as that is what is equivalent to res.render()
You've got an extra slash that shouldn't be there.
This:
setRender('/front/index'),
should be this:
setRender('front/index'),