---
title: "Create and deploy a Node.js app in 5 mins with Express"
description: "Express, the world's most used Node.js framework, empowers developers to create backend web servers with JavaScript."
url: https://sevalla.com/blog/create-express-app/
---

[Blog](https://sevalla.com/blog/)

# Create and deploy a Node.js app in 5 mins with Express

Express, the world's most used Node.js framework, empowers developers to create backend web servers with JavaScript.

Updated: May 25, 2026·by Jeremy Holcombe

Express, the world's [most used Node.js framework](https://github.com/VanoDevium/node-framework-stars), empowers developers to create backend web servers with JavaScript. This framework provides most of what backend developers need out of the box, simplifying routing and responding to web requests.

We already have a guide on [everything you should know about Express.js](https://sevalla.com/blog/what-is-express-js/), so this hands-on article will show you how to use it. This tutorial explains how to create and deploy an example [Node.js](https://sevalla.com/blog/what-is-node-js/) app using Express.js.

## How to make apps quickly with Express.js

This walkthrough demonstrates how to create a web application that takes requests to an endpoint, reads a parameter from the request, and returns it as JSON. Then you'll deploy it to Sevalla and see how to add a database.

### Prerequisites

To follow this tutorial, ensure you have the following installed on your computer:

- [Node.js and Node Package Manager](https://sevalla.com/blog/how-to-install-node-js/) (npm) — Essential runtime environment and package manager for JavaScript.
- [Git](https://kinsta.com/blog/install-git/) — Distributed version control system facilitating collaborative software development.

## Express application generator

You can add Express to existing Node apps using the process outlined in our [Express.js guide](https://sevalla.com/blog/what-is-express-js/#how-to-create-an-expressjs-app), but if you're starting from scratch, there's an even faster option: the [Express generator](https://expressjs.com/en/starter/generator.html).

The official Express generator from Express.js is a Node package that allows you to generate a new application skeleton. This can be done by first creating a folder for your application and then running the `npx` command (available in npm 5.2.0 and later) inside it:

```
mkdir express-application && cd express-application
npx express-generator
```

Upon successful generation, the terminal displays a list of folders/files created and commands for installing dependencies and running the application. Install the dependencies by running the command below:

```
npm install
```

Next, launch your web server:

```
DEBUG=express-application:* npm start
```

The skeleton application has a prebuilt index route that renders a basic home page. You can view this in your browser by visiting `localhost:3000`.

### Exploring the skeleton Express application

When you open your Express application in your preferred code editor, you will find a basic structure that forms the backbone of your web application.

```
/
|-- /node_modules
|-- /public
|-- /routes
    |-- index.js
    |-- users.js
|-- /views
    |-- error.jade
    |-- index.jade
    |-- layout.jade
|-- app.js
|-- package.json
```

- **node\_modules:** This directory stores all the installed dependencies and libraries for the project.
- **public:** Contains static assets like CSS, JavaScript, images, etc. These files are served directly to the client's browser.
- **routes:** Holds files responsible for defining various routes and handling requests coming from different URLs.
- **views:** Contains templates or views that the server renders to create the user interface. Here, **error.jade**, **index.jade**, and **layout.jade** are templates written in the Jade templating language. They help structure and render dynamic content to users.
- **app.js:** This file typically serves as the entry point for the Express application. It's where the server is configured, middleware is set up, routes are defined, and requests and responses are handled.
- **package.json:** This file contains metadata about the application. It helps manage dependencies and project configuration.

### Understanding route handling

In your Express application, the **routes** directory is where routes are defined as separate files. The primary route, often called the index route, resides in the **routes/index.js** file.

This index route deals with a `GET` request, responding with a web page generated in HTML by the framework. Below is the code snippet illustrating how a `GET` request is handled to render a basic welcome page:

```
var express = require('express');
var router = express.Router();
 
/* GET home page. */
router.get('/', function(req, res, next) {
 res.render('index', { title: 'Express' });
});
 
module.exports = router;
```

If you modify the [res.render()](https://expressjs.com/en/api.html#res.render) function to [res.send()](https://expressjs.com/en/api.html#res.send), the response type changes from HTML to JSON:

```
var express = require('express');
var router = express.Router();
 
router.get('/', function(req, res, next) {
  res.send({ key: 'value' });
});
 
module.exports = router;
```

Expanding the capabilities, another route is added to the same file, introducing a new endpoint that accepts a parameter. This code snippet demonstrates how your application can handle traffic on a different endpoint, extract a parameter, and respond with its value in JSON:

```
/* GET a new resource */
router.get('/newEndpoint', function(req, res, next) {
  res.send({ yourParam: req.query.someParam });
});
```

Sending a `GET` request to `localhost:3000/newEndpoint?someParam=whatever` will yield JSON output containing the string "whatever".

![A GET request is made to the locally running application in Postman.](https://sevalla.com/images/blog/create-express-app/sending-get-request-postman.webp)

A GET request is made to the locally running application in Postman.

It's essential to restart the web server to implement new changes effectively.

You can check out the [complete project code on GitHub](https://github.com/olawanlejoel/express-skeleton-app).

## Deploy your Express app to Sevalla

Sevalla runs your app from its Git repository. The generated app reads its port from the `PORT` environment variable (see **bin/www**), and Sevalla sets that variable for you, so the app is ready to deploy as it is.

1. Push your project to a GitHub, GitLab, or Bitbucket repository.
2. In the [Sevalla dashboard](https://app.sevalla.com/), click **Applications** in the sidebar, then click **Create** \> **Application**.
3. Under **Source**, click **Private repository** and choose your **Git provider**. If it isn't connected yet, click **Connect to GitHub** (or GitLab, Bitbucket). Then choose your **Repository** and **Branch**.
4. Under **Details**, check the application's **Name**. Under **Location**, choose the **Data center** closest to your users, and under **Resources**, choose a **Size**.
5. Click **Create application**.
6. On the application's **Overview** tab, click **Deploy now**, check the branch, and click **Deploy**.

When the deployment finishes, open the application's `sevalla.app` domain to see the home page, and add `/newEndpoint?someParam=whatever` to the URL to see the JSON response.

A new application doesn't redeploy when you push. To deploy every push to your branch, open the application's **Settings** tab, click **Update auto-deploy**, and turn on **Auto-deploy**.

### Add a database

If your app needs a database, create one in the same data center as the app and connect it over Sevalla's private network:

1. Click **Databases** in the sidebar, then click **Create database**.
2. Choose an engine and version, for example **PostgreSQL**, keep the generated credentials, and choose the same **Data center** as your application.
3. Click **Create database**, and wait for its status to change to **Ready**.
4. On the database's **Networking** tab, under **Private networking**, click **Add internal connection**. Choose your application and turn on **Add environment variables to the application**.
5. Click **Add internal connection**, then deploy the application again so it picks up the new variables.

Your app can then read the connection details from environment variables such as `DB_URL`, `DB_HOST`, and `DB_PASSWORD`. For the details, see [Connect to a database](https://docs.sevalla.com/databases/connect).

## Summary

This article demonstrated how the Express framework makes creating a Node.js application quick and easy. You can create a new application with the Express generator in just a few simple steps. With [Sevalla Application Hosting](https://sevalla.com/application-hosting/), deploying the app is streamlined and requires minimal setup.

Share on:[Tweet](https://x.com/intent/post?text=I've just read this article "Create and deploy a Node.js app in 5 mins with Express" on @sevalla%5Fhosting 's blog: https://sevalla.com/blog/create-express-app/ "x.com")[Reddit](https://www.reddit.com/submit?url=https://sevalla.com/blog/create-express-app&title=Create and deploy a Node.js app in 5 mins with Express "Reddit")[HackerNews](https://news.ycombinator.com/submitlink?u=https://sevalla.com/blog/create-express-app&t=Create and deploy a Node.js app in 5 mins with Express "HackerNews")

## Deep dive into the cloud!

Deploy your application, database, or static site in minutes.

[Get started](https://sevalla.com/signup/)
