Practice exercises CHAPTER 10 429
- Test your work by running the website, using the following command in the command
prompt window.
node app.js
You should see the listening message, as shown in Figure 10-2.
FIGURE 10-2 he running chat serviceT
Exercise 2: Create the chat client
In this exercise, you continue with the chat service from Exercise 1 and add the chat client
code. When you’re finished with this exercise, you will have a functional chat application.
- Open the client website, which is different from Exercise 1. Open Visual Studio
Express 2012 for Web. Click File, choose Open Web Site, and select the public folder
under the chat_service. - In the Solution Explorer window, right-click the public node, choose Add, and then
select HTML Page. Name the file Index.html and click OK. - In the Solution Explorer window, right-click the public node. Click Add, choose Style
Sheet, and name the file default.css. Click OK. - In the Solution Explorer window, right-click the public node, choose Add, select New
Folder, name the folder Scripts, and click OK. - In the Solution Explorer window, right-click the Scripts folder, choose Add, select
JavaScript File, name the file default.js, and click OK. - Add the jQuery library by right-clicking the public node. Choose Manage NuGet
Packages, select Online, and type jQuery in the search box.
You should see jQuery, as shown in Figure 10-3.