DEV Community

Cover image for Build simple Express Js application in 1 minutes with create-express-app
Yasser Ameur el idrissi
Yasser Ameur el idrissi

Posted on • Updated on

Build simple Express Js application in 1 minutes with create-express-app

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.
Let’s start...

  1. Install create-express-app

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
Enter fullscreen mode Exit fullscreen mode

After the process finished successfully, you have it installed. Let’s create our app!

  1. Create the application

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
Enter fullscreen mode Exit fullscreen mode

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 
Enter fullscreen mode Exit fullscreen mode

You will be prompted to pick a template. Supported template are :

  • cra-template-es5
  • cra-template-es6
  • cra-template-typescript

Each template comes with a basic Jest + ESLint setup.

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!

  1. Start the application

Let’s start our expressapp with the following commands:

npm run start
Enter fullscreen mode Exit fullscreen mode

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.
GitHub: https://github.com/getspooky/create-express-app
Website: https://getspooky.github.io/create-express-app/

Have a nice coding!

Top comments (3)

Collapse
 
stokry profile image
Stokry

Nice one!

Collapse
 
getspooky profile image
Yasser Ameur el idrissi

We encourage you to contribute to create-expressjs-app
GitHub: github.com/getspooky/create-expres...

Collapse
 
stokry profile image
Stokry

I will check your repo.