Chatty Chat - Part 1: Setting Up

Node.js JavaScript Express.js
Transcript

English (Auto-generated)

Hi everyone in this cast, we're going to set up a standard express app for our project. So I'm in my terminal and now I'm going to see the which is change directory to the desktop and now I'm on my desktop. So let's navigate to our project folder. So CB chappy chat, that's what it's called. And so let's open up the code editor and just briefly go through these files that you have here so you can see that there is a public folder and inside the public folder we have index dot html. And we also have a style dot CSS which has been provided to you and we have room dot html which is the chat room. And then there's an empty script file called a script dot gs. So some starter html and CSS files have been provided to you now by using npm. So node package manager, let's make our package dot jayson file in the terminal. So npm in it. And I'm just gonna go ahead and uh you know, leave all the fields be as is so just pressing enter and I just noticed that the entry point here is index dot Js. So this means that the server is gonna run from this file and I'm just gonna leave everything as is and there you go. So now if I go back here to my code terminal uh sorry, my code editor, you will see that inside package dot son. I have all of these fields and basically uh this out here means that the silver is going to run from this file. So let's make an index dot Js file and in the main directory. So not under public but right in the main folder. So I'm going to call it index dot g s and you can call it silver dot gs if you want. But just remember to then also change this here in package dot jayson. Okay, so once again, this file is made in the main directory under chatty chat and it's not under the public folder. Now, let's go back to our terminal and let's add a few packages that we need. So, I'm going to do NPM install Express because we're going to be using the Express framework. And then we also went to Npm install a socket dot io. So our project is going to use the socket dot io library which allows for bidirectional communication between two clients and we are then. So let's wait for this. Okay, great. So we're also going to now Npm install um you I d. Now this stands for universally unique id identifier. And this package offers a secure way to generate strong unique identifiers in a node. So basically we'll be generating room and numbers unique room numbers that people can join. And let's head back to our code editor and once again in package dot jayson. There you go. So now under dependencies you can see all the packages that we just installed. So let's move on to the next part where we're going to get a silver up and running with Express.
122 Views 0 Likes 0 Comments

Let's set up our Express.js app and install all the packages that we need.

Comment
Leave a comment (supports markdown format)