Module 3 - Building A Web-App
Module 3 - Building A Web-App
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
Contents
Objective:
Topics:
1. Recap
2. Domain names
3. Hosting
4. Web application code
5. Deploying application code
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
Building a webapp...
Web server
response
Network Browser
(web client)
request
Computer (host)
This is what we
need to set up,
to serve our own
webapp
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
Build a webapp that others can use?
Building a webapp involves the following steps:
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.1 Get a domain name
● Get a domain name so that people can reach our web app.
● Buy a domain name using domain registrars.
● Registrars take your domain name and make sure that no-one else, including other registrars can
use that name while you have it.
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
Web server
response
Network Browser
(web client)
request
Computer (host)
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.2 Set up a web server - I
We need to get a computer and a unique IP.
1. Buy a computer
2. Connect it to your ISP
3. Get a unique IP for your computer that won’t change
4. Install your OS and web server software
Option 2:
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.2 Set up a web server - II
● The technical term for renting computational power from a vendor: hosting
● Many different types of hosting
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.2 Set up a web server - III
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.3 Link domain name to the server
● Next, you map the domain name to this IP
● This information is published by the registrar on their DNS servers so that
anyone in the world can now exchange your domain name for the IP
● You can access a webserver using its domain name or its IP.
ex: http://nptel.ac.in/ is the same as http://14.139.160.71/
IP
My Server mydomain.com
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.3 DNS propagation
● What happens when you set the IP for a domain?
● The DNS system is a globally distributed database of domain-name to IP
mappings maintained by many name servers spread over the Internet.
● When you update the domain-name to IP mapping with your registrar a gradual
wave of updates begins and DNS can take upto 48 hours to update worldwide!
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
Understand DNS in more detail!
https://howdns.works/
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.4 Write application code
Web server
response
Network Browser
(web client)
request
Computer (host)
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.4 Write application code
Write or install a program in your favourite language that can listen to a request and respond with
appropriate information. This is the web server that will serve your webapp.
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.4 Write application code
● Writing a program that knows how to listen on a network is quite hard
● Developers use several frameworks, libraries and tools that help them write only portions specific to
their application and avoid the complex bits.
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
3.5 Deploy code on your server
After writing and testing your code, the code needs to be deployed on the server:
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
Things to keep in mind
Things in our control These are things not in our control
Web server
Network
response Browser
(web client)
request
Computer (host)
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
A quick exercise
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
‘Inspect Element’ on Chrome.
1. Requests and responses
2. Different response types
3. Making arbitrary requests and checking responses
4. Modifying the HTML in the browser (because we have control)
5. Using the IP instead of the domain name
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
Chrome Dev Tools
1. Chrome Dev Tools (the window that opens up when you click on ‘inspect’) is a very powerful
analysis and debugging tool
2. https://developer.chrome.com/devtools
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
Summary
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)
What we covered
Domain names (required only if we don’t want people to use our IP).
A web server (either a software that we can directly use, or a software that we can write).
Deploying the web server code on the hosting provider’s given machine.
Introduction to Modern Application Development Dr Gaurav Raina (IIT Madras), Tanmai Gopal (Hasura)