联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

您当前位置:首页 >> C/C++程序C/C++程序

日期:2024-02-09 08:03

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.

版权所有:留学生编程辅导网 2021,All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。