SlideShare a Scribd company logo
Building Dynamic Web Applications
Howie Mao
May 2, 2013
Clients and Servers
The web runs on a client-server model
A server is a program that listens on a network for requests
and services the requests. A webserver is a server that sends
webpages as its service.
A client is a program that requests services from the server.
Your web browser is an example of a client.
How to write a server?
Server calls attaches itself to a port and starts listening for
connections
Each computer has many ports (literally numbers from 1 to
65535) allowing internet traffic to be delivered to the correct
server even if there are multiple servers on the same computer
A client connects to a server by specifying its address and port
What happens when I go to a website
Web browser (client) connects to webserver (usually on port
80)
Web browser sends an HTTP request, asking for a certain
resource
Server sends an HTTP response, consisting of a header, which
contains metadata about the resource being sent, followed by
the data for the resource itself (a web page) in the body.
Web Frameworks
For making web applications, you probably want more than
just a socket library
You use a web framework, which provides you with the utilities
to deal with HTTP requests and other parts of a website
In this talk, we will use Flask, a very simple framework for
Python
Routing URLs
The key function of any web framework
Takes a URL and decides what code to run
Can also use parts of the URL as data
Templating
Makes it easier to generate HTML (or anything else) using
changing data.
Key concepts are inheritance and substitution.
Databases
Allows for efficient storage and retrieval of user data.
Many different kinds of databases.
Relational, document-oriented, key-value, graph-based, etc.
Choice of database depends on type of data stored
Sessions and Cookies
Allows users to stay "logged in".
Server sends browser a cookie, a piece of data which the
browser stores locally.
When the site is revisited, the cookie is sent back to the server.
This tells server the user is logged in already.
Cookies can be given an expiration time, or can be told to
expire once browser is closed.
Security
Encrypt cookies used to store login info
Login credentials and session cookies should be sent in
HTTPS (encrypted HTTP).
Passwords should be hashed before storing in database.
Always escape user input before storing in a database or
putting in a template.

More Related Content

What's hot

Web server hardware and software
Web server hardware and softwareWeb server hardware and software
Web server hardware and software
Humma Rashid
 
Node Session - 3
Node Session - 3Node Session - 3
Node Session - 3
Bhavin Shah
 
Web server
Web serverWeb server
Web server
Sajan Sahu
 
HTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeHTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status Code
Abhishek L.R
 
Online Cloud Storage System By using PHP
Online Cloud Storage System By using PHPOnline Cloud Storage System By using PHP
Online Cloud Storage System By using PHP
Tuhin Ray
 
Internet server components
Internet server componentsInternet server components
Internet server componentsJay Patel
 
Le Wagon - Web 101
Le Wagon - Web 101Le Wagon - Web 101
Le Wagon - Web 101
Edward_Schults
 
Web Server - Internet Applications
Web Server - Internet ApplicationsWeb Server - Internet Applications
Web Server - Internet Applications
sandra sukarieh
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
Nuha Noor
 
Application enumeration and launch
Application enumeration and launchApplication enumeration and launch
Application enumeration and launchPraveen Bakka
 
Web servers – features, installation and configuration
Web servers – features, installation and configurationWeb servers – features, installation and configuration
Web servers – features, installation and configurationwebhostingguy
 
Meeting 4 : proxy
Meeting 4 : proxyMeeting 4 : proxy
Meeting 4 : proxy
Syaiful Ahdan
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
Sahil Agarwal
 
User server interaction
User server interactionUser server interaction
User server interaction
bhavanatmithun
 
Web Servers: Architecture and Security
Web Servers: Architecture and SecurityWeb Servers: Architecture and Security
Web Servers: Architecture and Securitygeorge.james
 
Firewall & Proxy Server
Firewall & Proxy ServerFirewall & Proxy Server
Firewall & Proxy Server
LakshyaArora12
 

What's hot (20)

Web server hardware and software
Web server hardware and softwareWeb server hardware and software
Web server hardware and software
 
Node Session - 3
Node Session - 3Node Session - 3
Node Session - 3
 
Web server
Web serverWeb server
Web server
 
HTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeHTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status Code
 
Online Cloud Storage System By using PHP
Online Cloud Storage System By using PHPOnline Cloud Storage System By using PHP
Online Cloud Storage System By using PHP
 
Internet server components
Internet server componentsInternet server components
Internet server components
 
Le Wagon - Web 101
Le Wagon - Web 101Le Wagon - Web 101
Le Wagon - Web 101
 
Proxy Server
Proxy ServerProxy Server
Proxy Server
 
Web Server - Internet Applications
Web Server - Internet ApplicationsWeb Server - Internet Applications
Web Server - Internet Applications
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 
Application enumeration and launch
Application enumeration and launchApplication enumeration and launch
Application enumeration and launch
 
Web servers – features, installation and configuration
Web servers – features, installation and configurationWeb servers – features, installation and configuration
Web servers – features, installation and configuration
 
Meeting 4 : proxy
Meeting 4 : proxyMeeting 4 : proxy
Meeting 4 : proxy
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
User server interaction
User server interactionUser server interaction
User server interaction
 
Www(alyssa) (2)
Www(alyssa) (2)Www(alyssa) (2)
Www(alyssa) (2)
 
Jax Ajax Architecture
Jax Ajax  ArchitectureJax Ajax  Architecture
Jax Ajax Architecture
 
zigbee
zigbeezigbee
zigbee
 
Web Servers: Architecture and Security
Web Servers: Architecture and SecurityWeb Servers: Architecture and Security
Web Servers: Architecture and Security
 
Firewall & Proxy Server
Firewall & Proxy ServerFirewall & Proxy Server
Firewall & Proxy Server
 

Viewers also liked

Hardware synth
Hardware synthHardware synth
Hardware synthHoward Mao
 
Practises for Product Owners
Practises for Product OwnersPractises for Product Owners
Practises for Product Owners
Peter Rubarth
 
Bicicletes
BicicletesBicicletes
Bicicletes
oliviajuliaenglish
 
H&m greets Street Chic
H&m greets Street ChicH&m greets Street Chic
H&m greets Street Chicbrynnazo22
 
Comcast Creates new Venture Firm with Former CFO
Comcast Creates new Venture Firm with Former CFOComcast Creates new Venture Firm with Former CFO
Comcast Creates new Venture Firm with Former CFOSteve Helmholz
 
Hardware Hacking and Arduinos
Hardware Hacking and ArduinosHardware Hacking and Arduinos
Hardware Hacking and Arduinos
Howard Mao
 
Frameworkism
FrameworkismFrameworkism
Frameworkism
Peter Rubarth
 
Training presentation
Training presentation Training presentation
Training presentation
Keyur Patel
 
Mastering the Unix Command Line
Mastering the Unix Command LineMastering the Unix Command Line
Mastering the Unix Command LineHoward Mao
 
Columna vertebral
Columna vertebralColumna vertebral
Columna vertebral
hernan guzman
 
Movimientos de la columna vertebral
Movimientos de la columna vertebralMovimientos de la columna vertebral
Movimientos de la columna vertebral
hernan guzman
 
Power plant performance_efficiency
Power plant performance_efficiencyPower plant performance_efficiency
Power plant performance_efficiency
Keyur Patel
 

Viewers also liked (12)

Hardware synth
Hardware synthHardware synth
Hardware synth
 
Practises for Product Owners
Practises for Product OwnersPractises for Product Owners
Practises for Product Owners
 
Bicicletes
BicicletesBicicletes
Bicicletes
 
H&m greets Street Chic
H&m greets Street ChicH&m greets Street Chic
H&m greets Street Chic
 
Comcast Creates new Venture Firm with Former CFO
Comcast Creates new Venture Firm with Former CFOComcast Creates new Venture Firm with Former CFO
Comcast Creates new Venture Firm with Former CFO
 
Hardware Hacking and Arduinos
Hardware Hacking and ArduinosHardware Hacking and Arduinos
Hardware Hacking and Arduinos
 
Frameworkism
FrameworkismFrameworkism
Frameworkism
 
Training presentation
Training presentation Training presentation
Training presentation
 
Mastering the Unix Command Line
Mastering the Unix Command LineMastering the Unix Command Line
Mastering the Unix Command Line
 
Columna vertebral
Columna vertebralColumna vertebral
Columna vertebral
 
Movimientos de la columna vertebral
Movimientos de la columna vertebralMovimientos de la columna vertebral
Movimientos de la columna vertebral
 
Power plant performance_efficiency
Power plant performance_efficiencyPower plant performance_efficiency
Power plant performance_efficiency
 

Similar to Intro webapps

0_Leksion_Web_Servers (1).pdf
0_Leksion_Web_Servers (1).pdf0_Leksion_Web_Servers (1).pdf
0_Leksion_Web_Servers (1).pdf
Zani10
 
Ch-1_.ppt
Ch-1_.pptCh-1_.ppt
Ch-1_.ppt
berihunmolla2
 
21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMSkoolkampus
 
WP Chap 1 & 2.pptx
WP Chap 1 & 2.pptxWP Chap 1 & 2.pptx
WP Chap 1 & 2.pptx
AnkitaChauhan79
 
WWW & HTTP
WWW & HTTPWWW & HTTP
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
sanjoysanyal
 
Internet
InternetInternet
Internet
manochitra10
 
Web Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfWeb Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdf
Raghunathan52
 
Web Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfWeb Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdf
Raghunathan52
 
web-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
web-servers3952 (1)qwjelkjqwlkjkqlwe.pptweb-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
web-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
20521742
 
Distributed web based systems
Distributed web based systemsDistributed web based systems
Distributed web based systemsReza Gh
 
Web Terminology
Web TerminologyWeb Terminology
Web Terminology
TanimSharia
 
Server Side Programming
Server Side ProgrammingServer Side Programming
Server Side Programming
Milan Thapa
 
Web server
Web serverWeb server
Web server
Nirav Daraniya
 
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
nrvalluri
 
Fundamentals of Web for Non-Developers
Fundamentals of Web for Non-DevelopersFundamentals of Web for Non-Developers
Fundamentals of Web for Non-Developers
Lemi Orhan Ergin
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket ProgrammingMousmi Pawar
 

Similar to Intro webapps (20)

0_Leksion_Web_Servers (1).pdf
0_Leksion_Web_Servers (1).pdf0_Leksion_Web_Servers (1).pdf
0_Leksion_Web_Servers (1).pdf
 
Ch-1_.ppt
Ch-1_.pptCh-1_.ppt
Ch-1_.ppt
 
21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS
 
WP Chap 1 & 2.pptx
WP Chap 1 & 2.pptxWP Chap 1 & 2.pptx
WP Chap 1 & 2.pptx
 
Webbasics
WebbasicsWebbasics
Webbasics
 
WWW & HTTP
WWW & HTTPWWW & HTTP
WWW & HTTP
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
 
Internet
InternetInternet
Internet
 
Web Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfWeb Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdf
 
Web Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfWeb Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdf
 
web-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
web-servers3952 (1)qwjelkjqwlkjkqlwe.pptweb-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
web-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
 
Distributed web based systems
Distributed web based systemsDistributed web based systems
Distributed web based systems
 
Web Terminology
Web TerminologyWeb Terminology
Web Terminology
 
Server Side Programming
Server Side ProgrammingServer Side Programming
Server Side Programming
 
Web server
Web serverWeb server
Web server
 
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
 
Fundamentals of Web for Non-Developers
Fundamentals of Web for Non-DevelopersFundamentals of Web for Non-Developers
Fundamentals of Web for Non-Developers
 
Web Servers (ppt)
Web Servers (ppt)Web Servers (ppt)
Web Servers (ppt)
 
Web servers
Web serversWeb servers
Web servers
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
 

Intro webapps

  • 1. Building Dynamic Web Applications Howie Mao May 2, 2013
  • 2. Clients and Servers The web runs on a client-server model A server is a program that listens on a network for requests and services the requests. A webserver is a server that sends webpages as its service. A client is a program that requests services from the server. Your web browser is an example of a client.
  • 3. How to write a server? Server calls attaches itself to a port and starts listening for connections Each computer has many ports (literally numbers from 1 to 65535) allowing internet traffic to be delivered to the correct server even if there are multiple servers on the same computer A client connects to a server by specifying its address and port
  • 4. What happens when I go to a website Web browser (client) connects to webserver (usually on port 80) Web browser sends an HTTP request, asking for a certain resource Server sends an HTTP response, consisting of a header, which contains metadata about the resource being sent, followed by the data for the resource itself (a web page) in the body.
  • 5. Web Frameworks For making web applications, you probably want more than just a socket library You use a web framework, which provides you with the utilities to deal with HTTP requests and other parts of a website In this talk, we will use Flask, a very simple framework for Python
  • 6. Routing URLs The key function of any web framework Takes a URL and decides what code to run Can also use parts of the URL as data
  • 7. Templating Makes it easier to generate HTML (or anything else) using changing data. Key concepts are inheritance and substitution.
  • 8. Databases Allows for efficient storage and retrieval of user data. Many different kinds of databases. Relational, document-oriented, key-value, graph-based, etc. Choice of database depends on type of data stored
  • 9. Sessions and Cookies Allows users to stay "logged in". Server sends browser a cookie, a piece of data which the browser stores locally. When the site is revisited, the cookie is sent back to the server. This tells server the user is logged in already. Cookies can be given an expiration time, or can be told to expire once browser is closed.
  • 10. Security Encrypt cookies used to store login info Login credentials and session cookies should be sent in HTTPS (encrypted HTTP). Passwords should be hashed before storing in database. Always escape user input before storing in a database or putting in a template.