$30
Assignment 2 - Client-Server application
This assignment has 3 parts and focuses on the development of a simple posting system based
on nodejs. In this assignment, you will train:
● the development of a stateful client-server application,
● use of asynchronous XHTMLHttpRequest
● testing of your code
Part A) 30 Points
Develop for the nodejs platform a post method called postmessage that accepts 2 parameters
(topic and data) and saves them together with a timestamp (date and time) in a file called
posts.txt. Make sure that if the file already exists that you add append it - if it doesn’t exist
you should create it. To simplify your task you may use the npm module express and
body-parser. No other libraries are to be used.
Obviously, you are free to use any standard nodejs module e.g. fs.
Part B) 50 Points
Develop a webpage called posting.html that allows a user to see all posts, and allows the
creation of new posts. You should only use asynchronous XMLHttpRequest calls for
client-server communication. To improve the user experience use alert to inform the user
about the success or failure of posting a new message. Ensure that the displayed posts are up
to date e.g. update the data on the webpage if another user made a post.
No javascript libraries are allowed for this part.
Part C) 30 Points
Write a test report that shows how you tested the nodejs code you developed. Your report (short
paragraph) should answer the following questions
● How did you test your code?
● How long does it take to process a single post?
● Does the size of the data submitted to the server impact the performance?
● What happens if 2 requests are sent at nearly the same time data to the server?
What to hand in?
Part a) - one file called server.js (make sure that calling nodejs server.js will work).
Part b) -one file called posting.html (this file should contain all JS code, and HTML)
Part c) - one file called report.pdf that contains your report.