I'm fairly new to the world of Node.js and I have some questions because I am greatly confused.
I did a project via Online Courses in Udemy
What got me confused, is that I read blog posts, did several google searches, and I found billions of courses, books, blog posts, technologies and this is where I am really greatly confused and I need to sort them on my head.
The only solution for me right is to create something on my own without any other courses, I got tired.
Doing courses and homework is easy, for example: write a sort function, make some classes or objects, sort by age, create some event listeners and so on. But what happens when you want to make a Full Stack Web App? And that's exactly where I'm stuck.
For starting I would like to create my own blog as full stack app
- /blog/posts // Select only the Title and a Short Description from the Table Posts
- /blog/posts/post_id // Select all from the selected title
My goal is to use 2 tables, the 1st will contain only id, post_title, and the 2nd will contain the post, date_created, primary_id, foreign_key (id from the 1st table) and will make them appear on my browser will relationships and I will also add comments from users via a different table. I'm sure with this I will be able to learn the basics for real.
Now, these are my problems:
1) Is node.js good for MySQL or PostgreSQL?
2) Which Template Engine should I use? I searched and I found many people mention Handlebars, pug, ejs.
As I mentioned I want to be able to pull data from a database and make it appear to the user. What is the best to be used with FrontEnd, I want for example something like:titleposts
Where title and posts will get them from the Database, also I would like to learn Angular and ReactJS in the future,
How can I render my webpages with ReactJS or Angular, do I have to use a template engine like ejs and combine ejs with React or is there any different way?
3) Should I learn webpack? I read webpack's description if I understand correctly if for example, I have billions of CSS and JS files, webpack combine all of them and serve only 1 CSS and 1 JS file to the end user, is that correct?
4) Should I learn Docker?
I have 3 PCs, A desktop with Windows, A laptop with Ubuntu and a VPS with Ubuntu Server, if I have understood correctly, with Docker you create a container, throw your app, nginx, MySQL server and with a command, you are done.
I know how to create services, install apps on Linux and I think it might be a lifesaver if I want to change VPS and for testing purposes to all of my machines (I think so)
Thanks a lot.
Top comments (2)
Okay, let's see if I can help a bit with all your questions.
As far as I know, Node has a driver for both. I don't know how good the driver for MySQL is, though. A blog is simple enough that you could use either without much trouble. You could also use MongoDB, which has the advantage of storing data in object-like documents. Here it all comes down to which one you feel most comfortable with.
You don't need to use a template engine to use React. React basically controls the state of your application and helps you separate it into components, which get updated when state changes. To render webpages with React, you just need to add it to your package.json and build it with something like webpack or parcel-builder.
It wouldn't hurt to learn. You could also go for parcel-builder, which is lighter and easier to configure. If you use React, SCSS or something like that, you'll need to use something to compile your stuff, though.
4) Should I learn Docker?
I think it's useful to have, and not particularly difficult to learn. Probably someone on DEV has written a four-minute article explaining how to use it.
Before we get too into this, it's worth keeping in mind YAGNI. It's best if you focus on getting the core functionality of your blog in place before thinking about ways to improve it.
The truth is that it doesn't matter - they'll both work perfectly. This isn't the kind of decision you should be wasting too much time on. Pick whichever you like best, and don't look back.
As above, this doesn't hugely matter. You can choose React here if you like, but it'll likely be a little harder. If this is your first time using a template engine, I'd pick something that resembles HTML (like handlebars) so you can get used to the concepts.
Probably not at this stage. Webpack is complex, and if we go back to YAGNI, it's a whole lot of effort for not much impact. When you've done everything else, you can come back and give this a try if you feel it's necessary.
As above, probably not right now. Composing apps out of Docker is useful since you can spin up copies of the environment easily, but at the cost of a lot of initial setup work. Are you going to be spinning up new instances of your blog to make that work worth it?