Answer the question
In order to leave comments, you need to log in
Cookie nodejs how to set?
How to set a cookie in the user's browser?
the server looks like this
http.on('request',function(req,res){
var nameFile=req.url.split('.').length==1?conf.get('htaccess')[req.url]:req.url,
expansion=(nameFile||'').split('.'),
existsFile=fs.existsSync('../site'+nameFile);
res.writeHead(existsFile?200:404,{
'Access-Control-Allow-Origin':'*',
'Content-type':conf.get('contentType')[expansion[expansion.length-1]]+';charset=utf-8'
});
existsFile?
res.end(fs.readFileSync('../site'+nameFile))
:
res.end('Page not Foud');
});
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