How To Start Web Development Using Javascript NodeJs
Web programming using Javascript |
Javascript is no doubt the easiest programming language, and that’s probably the reason why it is such a popular and very widely used programming language. Right now maybe you can only build website stuff, but actually it is general purpose that maybe in the future it will support programs in Javascript not just for website stuff.
Doing web programming using JS is as simple as installing Node js and creating package.json and one file that will be used as the main file to handle HTTP requests and return the response to the user.
If you are interested in learning programming, you can follow this tutorial on how to start building a website using Javascript, follow this instruction below.
1. Install Nodejs
You can find the installer here https://nodejs.org/en/download/, select base on the OS you are using such as Windows, Linux or Mac OS
2. Open your favorite text editor or IDE
For example VS code, Sublime text or whatever IDE you preferred to use.
3. Create a folder for your website project
4. Create a file named package.json
Here’s an example of the file package.json, you can modify the information based on your project needs.
5. Create a folder named src
6. Inside the src folder, create index.js
7. Here’s index.js will look like
8. Open terminal or command line, navigate to your project folder using CD command
cd your-project-folder
9. Type npm install then enter
10. Type npm start then enter
11. Now open web browser, visit http://localhost:8080
If you want to just play around with Javascript and Nodejs, and you don’t want to install those stacks above on your computer, here’s an online editor from Codesanbox that you can use to learn how to code a website in Javascript via online.
Here is Codesanbox Nodejs Example
If you are just starting to learn programming, it is much more fun to begin with web programming and using the programming language Javascript, because not only the simple and dynamic syntax of javascript, also you can find Javascript or JS reference in tons of online websites, blog or youtube. The number of people sharing JS tutorial is everywhere, so that if you get stuck, there’s lots of information you can use to help you solve the problem you are encountered.