Slip 11 - A) Create a Simple Web Server using Node.js that shows the college information.

Solution:


 var http = require('http');

var fs = require('fs');

http.createServer(function (req, res) {

fs.readFile('slip11.html', function(err, data) {

res.writeHead(200, {'Content-Type': 'text/html'});

res.write(data);

return res.end();

});

}).listen(8080);

Code for slip11.html

<!DOCTYPE html>

<html>

<head>

<title>form</title>

<style>

h1{text-align:center;

font-size:70px;

color:red;

}

p{

color:blue;

text-align:center;

font-size:20px;

text-decoration:underline}

h2{

text-align:center;

}

</style>

<body bgcolor=pink>

<h1>BJS  College</h1>

<center><img src=c.gif height=350 width=350></center>

<p>Pune University<h2>

BJS ASC COLLEGE<br>

Wagholi, DIST-PUNE 412207.<br>

Affiliated to Savitribai Phule Pune University, Accredited by NAAC 'A' Grade</p>

</h2>

<a href=demoa.html>Click Here For Registration</a></h2></body></html>

Post a Comment

0 Comments