JSFiddle - React, Tailwind, and code Playground

by Fareez Ahmed

HTML

<h1>A simple server</h1>
<button id="button"><a href="https://facebook.com">This is where I spend most of my day</a></button>
    <p>It's up and running!</p>
    <p>Thanks!</p>
<p> Here's my cat, who's going to miss me alot if I go to Seattle: </p> <img src="http://photos-d.ak.instagram.com/hphotos-ak-xap1/t51.2885-15/10474989_1532984490263579_481713510_n.jpg" alt="He's kind of shy"> 
<p>Fin</p>

CSS

body {
    background-color: aquamarine;
    margin: 0;
    padding: 0;
    border: none;
    text-align: center;
}

#button{
    background-color: white;
    padding: 10px 10px;
    border-radius: 15px;
}

a {
    text-decoration: none;
}

img {max-width: 55%}

JavaScript

// INSTRUCIONS:
//Create a simple http server using node. *
// This server should respond to a root-url request with a file called index.html. 
// Do not use ExpressJS. 
// Your code should have error checking and at least one callback. 
// Put five or more html elements in your index.html. 
// One of the elements should be a link to an external page.

var http = require('http');
var fs = require('fs');

http.createServer(function (request, response) {
      //console.log('ROOT REQUEST START HERE');
      // the function defined as the second argument to readFile is a callback that also does the error handling. 
      fs.readFile('./index.html', function(error, content) {
              if (error) {
                response.writeHead(500);
                response.end();
              }
              else {
                response.writeHead(200, { 'Content-Type': 'text/html' });
                response.end(content, 'utf-8');
              }
      });
      //console.log('ROOT REQUEST END HERE');
}).listen(8080);

console.log('Server running at http://127.0.0.1:8080/');