I'm a full stack web developer with the skills & knowledge necessary to create user-friendly, intera
Express.js is one of the most popular back-end frameworks nowadays, which lots of people find useful to learn. After mastering the theory, it comes the time to start the practice, and then it may seem a little bit difficult, how to start. But creating your first Express.js application doesn’t have to be so complicated.
In the beginning, we have to install create-express-app tool. which allows installing ready to use Expres.js application, with all needed dependencies. To install the tool, we have to use the following command in the command line:
npm install -g create-expressjs-app
After the process finished successfully, you have it installed. Let’s create our app!
Now, it’s super easy to create our first application using the create-express-app tool. We can do it with a single command in our command line. First, navigate to the folder where you want to have your application through the command line, and then run the following command, where expressapp is the name of our application:
create-expressjs-app init expressapp
When you create a new app, the CLI will use npm to install dependencies. If you have npm installed, but would prefer to use yarn , you can append --use yarn or -u yarn to the creation command. For example:
create-expressjs-app init expressapp --use yarn
You will be prompted to pick a template. Supported template are :
You can feel free to set a different name for your application. If the process finished successful, you should have your folder with the app ready! Let’s start the application now!
Let’s start our expressapp with the following commands:
npm run start
The first command is used to enter to the folder of our application, and the second one starts our app. By default, the application is open at localhost:4200
I hope you will find this tutorial helpful and use it as a base for your first
If you would like to contribute to create-express-app please feel free to check out the Contributing guidelines about how to proceed.
Have a nice coding!