Giter Club home page Giter Club logo

httpserver's Introduction

HttpServer

This repository contains code that is very inefficient, bit unstructured. Its essentially a noobs attempt at reinventing the wheel. Yet it exists and is super useful to get a strong intuition of how web frameworks (the wheel) work under the hood. Wearing a developers hat really helps in appreciating the plethora of tools out there. It also help one to learn to deploy them quickly with minimal effort.

Summary

First step is to create a server that can hendle all the website related requests by a browser. High level view of this process:

  • This server talks/listens via a socket which has a port number and an ip address. The socket 'listens' to any incoming request nested under an infinite while loop. It binds itself to one client and serves various requests send subsequently.
  • Each of these requests are binary representations of strings. Now, these strings could be anything but that would make most of these unintelligible to the server. No surprise, there is a standard format : HTTP that is followed throughout web, a global language.
  • After establishing this common language, some common rules for semantics are also standardized: for example, a client (mostly a web browser) is capable of rendering HTML into a website. This is another sub language in the semantics domain. This step involves creating some HTML formatted text sent as a payload of the global language HTTP. This string is created using Jinja2 library which can programaticaly populate some pre-written templates and render them as text.
  • Next is to map the various client requests to the resources available and return them (this is the main JD of the server). A python class handles this mapping.

How the WEB works:

TCP/IP communications model:

Socket Programming:

What is HTTP:

General Code optimizations:

Multi-threading

httpserver's People

Contributors

saksham20 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.