Saturday 27 October 2018

Static files not served from one of my "auth" route

Hi,I am doing something wrong using static file in node where I store custom css and asset.js data.I reference to them in app.js like soapp.use(express.static(path.join(__dirname, 'public')));In my public folder I have two subfolders for css and .js. I am using ejs template engine and reference them like this​If I go directly to my route and render the map view it work just fine (http://localhost:4321/map). The issue is when I try to render it from my auth route it is not referencing to the files properly. I am not sure what rookie mistake I might be doing?http://localhost:4321/auth/css/mystyle.css net::ERR_ABORTED 404 (Not Found)http://localhost:4321/auth/customjs/asset.js net::ERR_ABORTED 404 (Not Found)function allowAccess(req, res, next) {queries.getUserById(req.signedCookies.user_id).then(user => {if(user.id == req.signedCookies.user_id && user.admin == true) {next();} else {res.render('../views/pages/map')}})}​Any help is much appreciated

Submitted October 27, 2018 at 03:08PM by geoholic

No comments:

Post a Comment