mardi 24 février 2015

Node.js server app not showing CSS

I have the following code on my node.js server (I'm using express):



app.get('/appointment/:id',function(req,res){
res.writeHead(200,{'Content-Type':'text/html'});
res.write('<link href="public/css/style.css" rel="stylesheet" type="text/css">');
res.write('<form name="accept" action="http://localhost:8080/appointment/'+ req.params.id+'/1" method="post">');
res.write('<input id="accept" type="submit" value="Accept">');
res.write('</form><br>');
res.write('<form name="decline" action="http://localhost:8080/appointment/'+ req.params.id+'/0" method="post">');
res.write('<input id="decline" type="submit" value="Decline">');
res.write('</form><br>');
res.end();
});


In my root folder I have folder appointment/public/css/style.css.

When I open the web page it just displays 2 form buttons but without CSS applied.

The CSS code is:



#accept {
width:50px;
height:30px;
background-color:#00FF00;
color:#FFFFFF;
font-weight:bold;
font-size:120%;
}

#decline {
width:50px;
height:30px;
background-color:#FF0000;
color:#FFFFFF;
font-weight:bold;
font-size:120%;
}


What is the problem and how can I fix it?


Aucun commentaire:

Enregistrer un commentaire