How to Program a Website (Node.js Beginners Guide)

Introduction

This was a procrastinated last minute attempt to finish an assignment for school, I modified the names and such I originally had for this forum. Just know this wasn’t aimed at people who already have programming experience. This is going to be one of my more straight forward tutorials on web unlike my other guides seen here:

Web Development Guides

Web Development Introduction: Guide to Web Development

Roblox and Discord Bot: Guide to Scripting Bots | Javascript Tutorial | FunCaptcha and New Host Info

Without further ado, here you go.









Thank you for reading my awful guide.

Want to host it online? Read my previous guide on Web Development and use Heroku or Digital Ocean.

57 Likes

Also add pictures about how to publish the site so others can see it.

GitHub + Heroku is the easiest imo.

1 Like

Literally just read my web development guide which already covers this. I cover digital ocean and heroku.

1 Like

Just to clarify something, Netflix, Discord, and most of those other apps were built with React, a framework made by Facebook that helps you to make dynamic websites easier. It’s a really useful tool when using Node.js to make a website as it simplifies a lot of things.

5 Likes

This is definitely much better put together than other guides I’ve seen, however I feel you should specify that this is a static website.

Its still possible to make it dynamic, angular and react will still work for example.

1 Like

Yes, but my point was this specifically shows you how to make a static website, not that it isn’t possible to make a dynamic website.

I assume you are talking about using the app.get/post/etc methods which would make the site more dynamic in the responses you can provide correct?

I think there may be confusion here in this conversation between a dynamic front end such as React, Angular, Vue, etc and a statically served site which doesn’t have a dynamic request function.

I’m talking about the website itself serving static content.

Yes that is exactly what I was talking about. There’s a difference in the content served and the front-end changing the content via JavaScript frameworks. I was just trying to see if I could clear up or focus on what specifically you were trying to get at. The app.get and other methods would allow you to change the response dynamically based on e.g. cookies or the IP.

Correct, we’re both talking about the same thing. You can make this dynamic, however you mention “Beginners Guide” and I guarantee most people following this guide wouldn’t know how to, especially since the code stated above is only used for static content.

This isn’t really a guide, more like a website example since you’re not really teaching anything. You’re using HTML and web JS to make the website whereas node JS is for applications.

Its a step by step processing to serving up a basic site page so hence it is a guide.

Some server code guide :smiley: , I have been in and out of making websites for years but never really understood the server side using node.js or php.

1 Like

You should look into the MEAN Stack then, personally I prefer AngularJS over Angular 2+

1 Like

Personally, prefer Django framework due to it being high level but great tutorial anyways! :wink:

Great guide!

If I am to add something, I want people to be aware of the difference between syncronous functions and asyncronous functions - knowing the difference between the two is important as using one inappropriately could block the Event Loop (meaning all user actions on that process are blocked until that method is finished) and drastically decrease performance in your site.

For example, if you’re using fs (file system module) to append data to a file, you would want to use: appendFile, rather than appendFileSync.

Another great performance tip is to set the environment variable to PRODUCTION - this will majorly increase the speed of your web application.

Thanks for the guide, and I hope people enjoy making websites with NodeJS - programming in Node is a lot different than something like Python, so I wish you all good luck in learning it.

1 Like

My professor only allowed me 12 slides and this is 10 lol.

Loos good! Should use pug though instead of html, looks better and easier to write with.

React isn’t a framework, it’s a library. I’m a big fan of it but I know that it’s not a framework.

1 Like