diff --git a/main.js b/main.js index d0757f2..178a326 100644 --- a/main.js +++ b/main.js @@ -1,18 +1,41 @@ var http = require('http'); var fs = require('fs'); +var url = require('url'); var app = http.createServer(function(request,response){ - var url = request.url; - if(request.url == '/'){ - url = '/index.html'; - } - if(request.url == '/favicon.ico'){ - response.writeHead(404); - response.end(); - return; - } - response.writeHead(200); - response.end(fs.readFileSync(__dirname + url)); + var _url = request.url; + var queryData = url.parse(_url, true).query; + var title = queryData.id; + if(_url == '/'){ + title = 'Welcome'; + } + if(_url == '/favicon.ico'){ + return response.writeHead(404); + } + response.writeHead(200); + var template = ` + + + + WEB1 - ${title} + + + +

WEB

+ +

${title}

+

Hypertext Markup Language (HTML) is the standard markup language for creating web pages and web applications.Web browsers receive HTML documents from a web server or from local storage and render them into multimedia web pages. HTML describes the structure of a web page semantically and originally included cues for the appearance of the document. + +

HTML elements are the building blocks of HTML pages. With HTML constructs, images and other objects, such as interactive forms, may be embedded into the rendered page. It provides a means to create structured documents by denoting structural semantics for text such as headings, paragraphs, lists, links, quotes and other items. HTML elements are delineated by tags, written using angle brackets. +

+ + + `; + response.end(template); }); app.listen(3000);