I set a path like this
var path = require('path');
var express = require('express');
var app = express();
var admin = express();
admin.use(express.static(path.join(__dirname, 'public/')));
app.use('/admin', admin);
Then I defined some route, for example,
admin.get('/jobs', function(req, res){
res.render('jobs/index');
});
admin.get('/jobs/create', function(req, res){
res.render('jobs/create');
});
In the first route, static files such as js,css,imagesupload without problems. But in the second, it does not upload files.
Files uploaded in a form similar to this
<link rel="stylesheet" href="styles/css/main.css">
NOTE. The styles directory is under a shared folder in my working directory.
So what is the problem? What have I done wrong?
Ashot source
share