
Now, because we modified the file structure, our start server script won’t work. `public/` folder is at the root, and all the `.js` files are inside `server/` folder. Your file structure will look like this: This is how our file structure looks like.
Runjs vs make install#
Run this command to install Express and other packages. Installing Packages and Moving and Deleting FilesĪfter we have the generated project ready, we need to install the dependencies and move some folders. But you can use any text editor you want. For me, I just use VSCode so I just have my terminal and text editor open at the same time.
Runjs vs make windows#
For Windows Powershell and Linux terminals, use: Npx express-generator your-project-name -no-viewĪfter creating your app, you need to go to your app directory.

no-view flag means that we won’t be using any templating engine such as handlebars, ejs, or pug, for our skeleton Express app. You can name your-project-name with the name you like.
Runjs vs make code#
We need to convert it at this early stage because we need a way to verify if our ES6 code works. Using the Express generator, we will create a new project with generated code, move some files, and convert some code to ES6 syntax. That’s it, we’re good to go! Installing Express

That’s why we’ll install a package called nodemon, that executes something whenever we change a file in our code. When coding in Node.js, automatic restart of our server doesn’t come out of the box just like when doing a project made on-top of create-react-app or vue-cli. And for that, there’s an existing package called rimraf. That’s why we need a script that removes files before the fresh transpiled copy enters.

Whenever we change something in our code, we feed it to the transpiler, and it outputs a fresh copy every-time. This is where the package called babel shines.īabel takes a js file, converts the code in it, and outputs into a new file. Note that in today’s time, almost 99% of ES6+ syntax can be used in Node.js. ES5 code is the JS syntax style that is readable to node.js, such as module.exports or var module = require('module'). We need a package that translates ES6 and above syntax to ES5 code. To enable a front-end development-like experience while developing back-end apps, here’s a high level view of the processes happening to your project. ADVERTISEMENT How does it work? A high level view of what we need
