DEV Community

Marios T.
Marios T.

Posted on

Questions about Full Stack JS

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
https://yelpcamp-web-coders.herokuapp.com

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.

In the above project which was created in May, that project used Javascript 5 but that's ok. I learned a little bit of Node.js, npm, view engines and somehow managed to do it.

For starting I would like to create my own blog as full stack app

I know I can create a blog with Static HTML/CSS/Javascript and some JSON files but I want to do something more complex like for example when I or the user visits the following URL:

  • /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.

Discussion (2)

Collapse
savagepixie profile image
SavagePixie • Edited on

Okay, let's see if I can help a bit with all your questions.

1) Is node.js good for MySQL or PostgreSQL?

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.

2) Which Template Engine should I use?

Is there any reason you don't want to use vanilla JavaScript? There are plenty of template engines and all have their merits and demerits, but they don't do anything you can't do with vanilla.

EDIT: That is not to say that you shouldn't use a template engine or that they aren't useful. I just find it easier if I don't try to use too many new things in one project. If your goal is learning a template engine, go for it, I'm sure someone can give you a much better rundown of the main ones than I can. But if your goal is to learn JavaScript, I would suggest doing it in vanilla first and then maybe trying a template engine.

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?

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.

3) Should I learn webpack?

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.

Collapse
canderson93 profile image
Carl Anderson

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.

1) Is node.js good for MySQL or PostgreSQL?

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.

2) Which Template Engine should I use? I searched and I found many people mention Handlebars, pug, ejs.

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.

3) Should I learn webpack?

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.

4) Should I learn Docker?

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?