Last active
August 29, 2015 14:14
-
-
Save jsstoni/b5bfe99766fcfaff9dc9 to your computer and use it in GitHub Desktop.
problema con rutas get
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
url = require('url'), | |
path = require('path'), app = module.exports = express(); | |
app.engine('.html', require('ejs').__express); | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'html'); | |
var menu = [ | |
{titulo : 'Sobre Nosotros', link : 'about'} | |
]; | |
app.get('/', function(req, res) { | |
res.render('index', {menuNav : menu}); | |
}); | |
app.get('/cursos/:id', function(req, res) { | |
//console.log(req.params.id); | |
req.url = '/'; | |
res.render('cursos', {menuNav : menu}); | |
}); | |
app.use('/public/imagen',express.static(path.join(__dirname, 'public/imagen'))); | |
app.use('/public/fonts',express.static(path.join(__dirname, 'public/fonts'))); | |
app.use('/public/css',express.static(path.join(__dirname, 'public/css'))); | |
app.listen(80); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
en vez de usar 3 app.use para declarar las rutas de los archivos estaticos, usa solo una de esta forma:
y desde el html solo llamas: