首页 > > 详细

辅导 program、讲解 Java,Python程序语言

Assignment Instructions
The following instructions are intended to help you get started with the sample code
for the assessment with node js and codio. Your one page report should be
submitted as a pdf via the CA4 assessment link in my-aberdeen. There is no need to
submit your web application, it will be tested and marked via codio and marks will be
released on my aberdeen 3 weeks after submission.
Please follow the instructions below to get you started with using node js with codio:
1) Log into codio via my Aberdeen

2) Within codio create a new folder named CA4 and navigate into that directory
as shown below:
mkdir ca4 cd
ca4
3) Within the CA4 folder enter the following command:
npm init -y
This runs the node package manager and set up an empty project for you. We
will now use NPM to install some additional node JS packages / modules
which we will require for the chat application. Enter each of the following
commands (one at a time i.e. press enter after each, don’t try to run them all
at once)
npm install express
npm install socket.io
We have just installed the packages we require to develop the chat
application.
4) Now we will set up a few more things. Enter each of the following commands,
one by one as before:
touch index.js
mkdir public cd
public mkdir css
mkdir js
touch index.html
touch chat.html
cs css touch
demo.css cd ..
cd js
touch client.js cd
..
We have just created the necessary files and folders for the assessment and
returned to the main folder we stared off in. We can use the codio navigation pane
now to access these files and enter the demo code for the chat application.
5) Now we will enter the demo code for the application. Open the index.js file by
selecting it in the navigation pane as shown above.
Enter the code for the index.js file you downloaded from my aberdeen into the
index.js file you created in codio.
Do the same for each of the files you created in step 4 using the files you have
downloaded from my-aberdeen.
6) Now its time to test the application: return to the terminal and enter the
following command:
node index.js
Find the domain name for your codio box as shown below:
The internal browser in codio opens with the domain name we need:
Open a new tab in your browser. Copy and paste the URL for your codio box
into the new tab, but change the port number to 5000 i.e. above where it
shows -3000, this needs to be changed to -5000, see below:
Change the above to what is shown below, note the name of your codio
domain URL may be different but the format is similar:
Opening the codio box domain URL with the port changed to 5000 brings us to
the index page of our application:
Open another tab with the same URL, so we have two running in the browser
and can check the chat application is working as required:
In each tab select the chat link which should bring up the chat application. Try
sending messages from one tab to the other. You should see these displayed
in both windows:
To stop node js, return the the terminal and enter [control] + [c]
When you make changes, remember to stop the server and restart to view any
updates you make.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!