Assignments Node II

Handing In Assignments

You must hand in by using git

Hand In by git

  • Create an empty repo on bitbucket.org, gitlab.com, or github.com,
  • git push your local repo to the above remote repo.
  • For node assignments please put the line(s)

    node_modules/

    into your .gitignore file.

Send a mail to with:

  • The word 'handin <subjectname>' in the subject line of your mail
  • The url of your repo(s).

Assignment Node II.0

Using your own version of the lesson's myg52/main.js You should submit something like http://localhost:3000/test.html?name=Niels&position=Lecturer&height=183 to the started server.

Do the same experiment with different URL lines from your browser. Try varying the test.html to something else, and try varying the query string too.

Check the log of the server and write briefly an explanation to the output.

Assignment Node II.1

Using your own version of myg53/main.js. You must write an HTML5 page with a form containing three or four fields, ie similar to Example 16.5 but with more input fields. This page must be run in your browser via the file protocol. It cannot yet be served by your server. On submit it must use method="post" action="http://localhost:3000/" as server. The server must of course be started.

When you submit data from the form, check the log of the server and write briefly an explanation to the output. Explain also why the page with the form must be started with the file protocol.

Assignment Node II.1a

This is very similar to the previous assignment. Using your own version of myg53/main.js. You must write an HTML5 page with a form containing three or four fields, ie similar to Example 16.5 but with more input fields. This page must be run in your browser via the file protocol. It cannot yet be served by your server. On submit it must use method="get" action="http://localhost:3000/" as server. The server must of course be started.

When you submit data from the form, check the log of the server and write briefly an explanation to the output. Explain also why the page with the form must be started with the file protocol.

When you have finished testing this, explain the differences between submitting form data with the post, and with the get method. It seems to be a common misunderstanding that you can only request data with the get method. Is that true?

Assignment Node II.2

Write, test, and document a module libWebUtil.js that takes GET as well as POST data and turns them into Get and Post objects respectively. The objects must contain the received name, values pairs, and present them in the proper object syntax.

Assignment Node II.3

Change your own version of myg54/main.js so that an url not found by the server gets the response <h1>This is my 404, reguested url not found</h1>. The root of the server must continue to return the Welcome greeting.