Answer the question
In order to leave comments, you need to log in
Why doesn't the cutter appear?
In general, I test templates. And for this I wrote a server on IO.js. I struggled with MIME types for a long time, but when I saw that everything was correct, I realized that it was not about them.
The most surprising thing is that if I open not through a local server, then everything is ok.
The code
var http = require('http'),
fs = require('fs'),
typer = require('./typer.js');
http.createServer(function (request, response) {
console.log(request.url);
if(request.url == '/'){
request.url = 'chablone1.html';
} else {
request.url = '.' + request.url;
}
var options = {
'Content-Type': typer.type(request.url)
}
response.writeHead(200, options);
function data(chunk){
response.write(chunk.toString());
}
function end(){
response.end();
}
var file = fs.createReadStream(request.url);
file.on('data', data);
file.on('end', end);
}).listen(80);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question