vendredi 2 janvier 2015

unable to use multiple static paths for frontend and backend in expressjs

I am creating a nodejs/backbone application and wish to keep the directories for backend and frontend different. Here is my directory structure:



├── backend
│ ├── api
│ ├── file-uploads
│ └── ui
│ ├── assets
│ │ ├── css
│ │ ├── images
│ │ └── js
│ └── index.html
├── frontend
│ ├── assets
│ ├── index.html
│ └── modules
├── index.js
├── npm-debug.log
└── package.json


In the index.js file, i have the following code



app.use(express.static('/admin',__dirname + '/backend/ui/'));
app.use(express.static(__dirname + '/frontend/'));


Now the url / works fine and display the index.html file inside the /frontend directory but the url /admin doesn't work. I am expecting it to display the index.html file inside /backend/ui/ directory. Where I am going wrong here?


Aucun commentaire:

Enregistrer un commentaire