Tutorial create sample static website using Node.js

in utopian-io •  7 years ago  (edited)

Description

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. in this video below, i explain how to creating sample static website using node.js.

What Will I Learn?

  • How to create about, contact, home and convert it to html.
  • How to create server function, request, response etc.
  • How to combine about, contact, and home in one node.js server.
  • Checking the active status of node.js with Command Prompt.
  • Creating localhost.

Requirements

Write here a bullet list of the requirements for the user in order to follow this video tutorial.

  • System Requirements: Program Install Support Install and Uninstall
  • System Requirements: No special requirements
  • OS Support : C, C++, JavaScript Operating system Linux, macOS, Solaris, FreeBSD, OpenBSD, Microsoft Windows (older versions require Cygwin), webOS, NonStop OS
  • Written in : C, C++, JavaScript

Information

Read more - Wikipedia

Node.js - blog

Difficulty

  • Intermediate

Tutorial Contents

In this tutorial I explain how to create a sample website using node.js command.

the tools we need are

  • Node.js
  • Notepad ++, this is useful for editing html type files
  • Command Prompt, to give commands and check status

after having the following tools let's start the tutorial

Capture.PNG

  • the first step is to create a folder with the name according to your needs, then open the folder and create again a new folder, as in the photo above for example, I created a folder on the desktop.

1.png
2.PNG

  • then open the new folder, and create 3 new text document, then change the text document format to html. here I created a file with html format with the name about, contact, and home. you can see the photo above.

3.PNG

  • then open the html file using Notepad ++ to create the html framework, do one by one of the three html files. then make the contents of the file about html and save, you can see the photo above.

4.PNG

-5.PNG

  • then continue by opening the contact.html and home.html files. then create contents like the photo above and save

-6.PNG

-7.PNG

  • after you save and return to the main folder, here I use sample-folder website as the main folder, then create the text document again and change the format to js. edit the file format .js like in the photo above then save.

-8.PNG

  • Then to test the html we use Command Prompt, you can find the command prompt program on the Start menu and Search Command Prompt. Give cd desktop command on command prompt, then cd sample-website (name your main folder), then node sample website.js. If the way and the code you use is correct it will look like the photo above

9.PNG

Then continue by creating localhost on the static-website.js file. and you can change listen code to as needed. here I change listen to 8654. you can see the example of the localhost manufacture like the photo above. then save.

10.PNG

Then check the activation of localhost at the command prompt, if true then it will look like the photo above, and you can directly google to see the result, type "localhost: 8654" on google and it will look like the photo below :

11.PNG

Curriculum

this is my first tutorial on Node js.

Thank you for reading a tutorial !



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.
My Opinion

  • In the next tutorial please put the code without being by image. Following an example in a tutorial it is important that you copy and paste the code into your project.

You can contact us on Discord.
[utopian-moderator]

Hey @portugalcoin, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Hey @darsondrew I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x