javascript - CSS not loaded in Node Express application -


i have problem node express project. cannot seem have css load browser. here how mu project structure looks like.

note: adminview folder views admin section page (cms), contains own css, javascripts, , images on folder.

public/   css/   images/   js/ routes/   index.js   users.js views/   adminview/   layouts/     layout.hbs   index.hbs 

when access index(.hbs) page, loads css well. know worked because:

  • i have specified layout file on app.js

    app.engine('hbs', hbs({extname: 'hbs', defaultlayout: 'layout' , layoutsdir: __dirname + '/views/layouts'})); 
  • i have specified css,js, , images on layout.hbs file

i trying access page user.js route.

my question is, how load css file on adminview folder? when inspect on page, tells me trying load css localhost:8000/users/css/bootstrap.css.

how make particular route taking getting css,js, , images folder below?

enter image description here

edit: added routing files,

index.js

var express = require('express'); var router = express.router();  /* home page. */ router.get('/', function(req, res, next) {   res.render('index' , {title: 'test title'}); });  module.exports = router; 

user.js

var express = require('express'); var router = express.router();  router.get('/admin', function(req, res, next) {   //res.send('user details');   res.render('adminview/index2', {title: 'admin page'}); });  module.exports = router; 


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -