Quickstart: Deploy an Express.js App
This guide explains how to deploy an Express.js application to seenode.
Deploy an Express.js Template
Section titled “Deploy an Express.js Template”Get started in seconds by deploying our pre-configured Express.js template. This example is ready to deploy and reflects the structure discussed in this guide.
Express.js Template
Deploy an Express.js project pre-configured for production.Deploying an Existing Express.js Project
Section titled “Deploying an Existing Express.js Project”Follow these steps to prepare and deploy your Express.js project.
-
Prepare Your Project for Production
Your project structure should be ready for deployment.
Project Structure
A minimal Express.js project contains a
main.js
entry point and apackage.json
file.Directoryyour-express-project/
- main.js // The application entry point
- package.json
Dependencies
Make sure your
package.json
listsexpress
as a dependency.package.json {"name": "example-nodejs-express","version": "1.0.0","main": "main.js","scripts": {"start": "node main.js"},"dependencies": {"express": "^4.18.2"}}Run
to create yournpm installpackage-lock.json
file.Application Code
Your
main.js
file should create an Express server that listens on a port defined by an environment variable. This allows seenode to correctly route traffic to your application.main.js const express = require('express');const app = express();const port = process.env.PORT || 3000;app.get('/', (req, res) => {res.send('Hello World\\nWelcome to Seenode!');});app.listen(port, () => {console.log(`Example app listening on port ${port}`);}); -
Deploy on seenode
Follow these steps to deploy your Express.js application:
- First, create a new Web Service from the seenode Dashboard and connect your Express.js project’s Git repository.
- Configure your build and start commands. seenode will attempt to detect these automatically.
- Build Command: npm install
- Start Command: node main.js
- Build Command:
- In the Environment tab, set a
PORT
variable (e.g.,8080
). seenode does not automatically assign one. - Choose your preferred instance size and create your service.
- Watch your deployment progress in real-time through the Logs tab.
- Once complete, your Express.js application will be accessible via your service’s URL.
Next Steps
Section titled “Next Steps”Now that your Express.js application is deployed, here are some things you might want to do next:
Set up a Custom Domain (Coming Soon)
Configure a custom domain to point to your new web service.Connect to a Database
Instantly scaffold and connect PostgreSQL and MySQL databases