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:
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.
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.
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.
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.