Writing a Simple Web Server in HTML

Welcome to Web 0.0

boots
2 min readNov 1, 2014

Photo by Luke [Public domain], via Wikimedia Commons

There has been a lot of talk about the internet these days.

So much talk, that you might be wondering…

How does the internet work?

Well, for starters, that’s a dumb question. It doesn’t matter. What matters is that the internet does work.

So, you should really be asking yourself…

How do I get the internet to work for me?

Why?

Because it turns out that the internet is made up of a bunch of servers, which are things that usually serve stuff to you.

But did you know that you can make servers serve stuff for you?

I hope you’re getting the picture here, because I am about to show you four easy steps to coding your own web server in the world’s most beloved programming language, HTML.

1. Pull up your favorite text editor

This is a program like Medium, Microsoft Paint, or Apple’s universally-loved-and-used text editor, Pages.

2. Pick a random number

For the purposes of this tutorial, I’ll choose a rough approximation of pi, 3.14.

3. Paste in the following code:

<html>Server listening on port 3.14…</html>*

Of course, you should replace 3.14 with whatever number you chose in step 2.

* NOTE: This has been known to cause issues in Internet Explorer.

4. Open up your file in the browser

And Voilà! You just coded the internet.

You should see all the code you coded in step 3, which means you just coded your first web server in html, which means you are a coder now. Congratulations!

Currently, your server is only listening, so you can talk to it all you want, but it won’t respond.

That might seem kind of mean, but sometimes, it’s nice just to know that someone’s there, right?

Stay Tuned!

In my next post, we will build upon what we just learned, and I will show you how to write a Hello World big data web application in CSS3.

--

--