1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| var http = require('http'),
fs = require('fs'),
express = require('express'),
app = express();
// Creation du serveur
var app = http.createServer(function (req, res) {
// On lit notre fichier app.html
fs.readFile('page.html', 'utf-8', function(error, content) {
var img = fs.readFileSync('./hopital de garches.jpg');
res.writeHead(200, {'Content-Type' : 'text/html','images/jepg'});
app.use(express.static(__dirname + '/Documents/Nouveau Dossier'));
res.end(content,img, 'binary');
});
});
app.listen(8080); |
Partager