vendredi 28 novembre 2014

express js routing issue


I wish to call my index.html page while using sendFile, but I ran into a problem. The problem is that it actually shows me the index.html although without any css and js\jquery effects.


server.js:



var express = require("express");
var app = express();

var server = app.listen(8000, function () {

var host = server.address().address;
var port = server.address().port;

console.log('Example app listening at http://%s:%s', host, port)

});
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html')

});




Aucun commentaire:

Enregistrer un commentaire