Build a web application using Node and Express - Webbprogrammering/websoft GitHub Wiki
This is the assignment A04 for "Section 04: Server side JavaScript with Node and Express".
You should save your work in work/s04/a04
.
Prerequisites
You have worked though the following articles.
Information
You should use the experienced gained from the above articles to produce a website, or web application, using JavaScript, Node and Express.
The lottery Lotto is a swedish game lottery. It will be used as the base for this assignment.
Requirements grade 3
-
You should create an Express application that can be started using
node index
and it should run on port 1337. -
Add a copy of your
work/report
so it can be accessed through the pathreport.html
. -
Add a path
lotto
that prints out a web page showing a lotto draw, a serie of 7 numbers, all between 1 and 35. -
Organise your code in files and modules.
Requirements grade 4
-
Do all requirements for grade 3.
-
Add the path
lotto-json
which produces a JSON response of the lotto draw. -
Enable to send in your own lotto row, through the query string, like this
lotto-json?row=1,3,7,9,28,33,35
-
The JSON response should contain the data of your own row of numbers.
-
The JSON response should contain how many numbers you had correct.
Requirements grade 5
-
Do all requirements for grade 4.
-
Enable to send in your row through the query string, using
lotto?row=1,3,7,9,28,33,35
. -
Update the web page and do a nice output showing a table where your own numbers are marked.
-
Update the web page and do another nice output showing a table where the actual number from the lotto draw, are marked.
-
Add to the page, a message showing how many correct numbers you had.
Optional and for the fun of showing off
This exercise connects client side fetch()
(A03) with the server side JSON REST API (grade 4 above).
- Add a page
lotto.html
that has client side JavaScript where the user can enter a serie of figures through a HTML form element, when a submit button is pressed the row is sent to the server, throughlotto-json
. The JSON response is retreieved in the page, and without reloading the page it is updated showing how many hits you had with your lotto serie.