Summer 2016 | University of California, San Diego CSE Department
Homework #2 - Language and Architecture Basics
This homework presents an opportunity to prove to ourselves that the languages and architectures used in Web programming are quite related to each other. Their are trade-offs with the different approaches, but our small test programs we write in this homework might sway us not to get caught up in the syntax of the moment battle and focus on the parts of Web development that are more similar than different.
Our aim for this homework is to write the following small programs as tests of core server-side Web basics:
"Hello World" – A server-side program that print “Hello Web World from Language X on date time stamp” where X is the language being used. The page also should randomly use a background color of either red, white or blue just to show you besides the date that it is a generated page.
"Environment Variable Echo" - If you load this page in the browser the program will print out all the environment variables from the request and related values.
"Session Test" - Write two pages (sessionpage1 and sessionpage2). On sessionpage1 collect the users name. Save this value to a session. Click a link and load sessionpage2 view a message on page2 that says "Hi <username> nice to meet you!" if the value is set. If the value is not set in session write out "Howdy stranger...tell me your name on page1!" Add a button on sessionpage2 labeled "Clear Session" if you hit that button it will kill the session data. All sessionization should be performed using standard cookie approach.
You will write all these programs in 3 different ways
CGI with Perl (you may use a CGI helper library if you like - quite important for the sessioning!)
NodeJS (with or without Express)
Your current server should handle the CGI and PHP content already. If not fix this first before starting. You likely will not have NodeJS running yet so once you are at that step add it to your hosted environment before coding. You should approach the programs in order first with CGI, then PHP, then Node. The order may reveal something itself. Advanced students may write the same 4 examples as Apache Modules if they desire for a bonus, but should speak to the Prof. before undertaking that effort for advising.