DEV Community

Cover image for Deploy Express.js app to Vercel

Deploy Express.js app to Vercel

Ha Tuan Em on July 04, 2021

After research how to deploy Express.js app to Vercel. Finally, I found and got have an application has deployed to Vercel. It's take a lot of time...
Collapse
 
catur profile image
Catur Wicaksono

this is awesome.. but when i try to build using express generator, it doesn't work, is there any help :(

Collapse
 
hte305 profile image
Ha Tuan Em

Vercel is not supporting the Express Generator at the moment. Becasue it's attach to the pattern of serverless. Instead, you can use express traditional. Thanks.

Collapse
 
mohaymenrafi profile image
mohaymen_rafi

Thanks!

Collapse
 
latze profile image
latze

So i created an api with express
can i use vercel to deploy it?

Collapse
 
hte305 profile image
Ha Tuan Em

Yes, you can.

Collapse
 
erfelipee profile image
Felipe

Thanks!

Collapse
 
jdgamble555 profile image
Jonathan Gamble

Could you show us how to do this with Angular Universal or NestJS?

Collapse
 
hte305 profile image
Ha Tuan Em

I will try it.

Collapse
 
sh20raj profile image
Sh Raj • Edited
{
    "version": 2,
    "builds": [
      {
        "src": "server.js",
        "use": "@vercel/node"
      }
    ],
    "routes": [
      {
        "src": "/(.*)",
        "dest": "/"
      }
    ]
  }
Enter fullscreen mode Exit fullscreen mode
Collapse
 
thechallengerr profile image
thechallengerr

But how can I deploy a express - handlebars to vercel ? Here is my folder structure and vercel.json :

Image description

"builds": [
        {
            "src": "src/*.js",
            "use": "@vercel/node"
        }
    ],
    "routes": [
        {
            "src": "/(.*)",
            "dest": "./src/routes/index.js"
        }
    ]
Enter fullscreen mode Exit fullscreen mode
Collapse
 
ajmirsarker profile image
Arafat

have you got any answer?

Collapse
 
samx23 profile image
Sami Kalammallah

How about a full stack app where I use express on folder /server and react on /client ?

Collapse
 
hte305 profile image
Ha Tuan Em

Waiting for my new post 😀

Collapse
 
barhoumimohamedali profile image
Barhoumimohamedali

thanks , this is really useful!

Collapse
 
sidtalesara profile image
sid-talesara

Thanks man. I was stuck in last step and this helped me a lot.

Collapse
 
kpripper profile image
kpripper

Your app doesn't work express-vercel-theta.vercel.app
Cannot GET /

Collapse
 
khalby786 profile image
khaleel gibran

This is really great, but isn't that the whole point of serverless functions?

Collapse
 
hte305 profile image
Ha Tuan Em

Actually, Express is a traditional server. It's not supported by serverless. But you still want to covert Express to serverless app. You can find out in this article. But I recommend you should using Next.js to making an awesome application with full serverless function.
Thanks =)

Collapse
 
fecocode profile image
Feco

Thanks @hte305 !

Collapse
 
hte305 profile image
Ha Tuan Em

Hope, it helps something to you.

Collapse
 
kamalhossain profile image
Kamal Hossain

Is it completely free?

Collapse
 
hte305 profile image
Ha Tuan Em • Edited

As you wish 😉

Collapse
 
kbcruz6 profile image
Agustin Cruz

Hi ! I am having an issue, I can see my express app (which has front too) in localhost successfully, but when i deploy it in vercel, I cannot see the app, what should i do?}
ThankS!

Collapse
 
rst1705 profile image
MechInTech

this is awsome ,hey can i use mongodb data base for this as well

Collapse
 
letsbsocial1 profile image
Maria Campbell

I'm working on a next.js app which uses mongod and host my backend on MongoDB Atlas. Yes, you can use MongoDB. And better yet would be to use Mongoose because of its schemas.