DEV Community

Cover image for Deploy Express.js app to Vercel
Ha Tuan Em
Ha Tuan Em

Posted on • Updated on

Deploy Express.js app to Vercel

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 from me but I am happy and hope this article will help something to you.

I. First of all, creating new Github repository and init new project nodejs.

Clone and init project

II. Creating new project in Vercel

image

III. Installing package express to nodejs app.

install express package

IV. Creating and endpoint file index.js in root source.

Creating index.js file

V. Creating APIs in ./api folder or you can rename anything which you like.

  • Here is an example for manage product from ./api/product.

API folder

VI. Testing before commit source to Github.

Testing

  • After testing is 👌. Commit them to git to see something awesome.

VII. Ready to serve in Vercel.

image

VIII. Something went wrong in Vercel.

image

  • Because Vercel just supports API from Framework JS as NEXT.JS, Nuxt.JS,... So if we develop a standalone application we need to configure or tell the server of Vercel how is it work by vercel.json file.

IX. Add new vercel.json file to root source.

  • Commit it to GitHub and make sure version is 2 - this is required from Vercel.

Vercel.json file

X. Done, enjoy your moment.

Thanks for reading.
And I hope something good to you.
Here is repository which use in this post.


Buy me a coffee

XI. Or you can follow this tutorial in youtube.

Discussion (10)

Collapse
kamalhossain profile image
Kamal Hossain

Is it completely free?

Collapse
hte305 profile image
Ha Tuan Em Author • Edited

As you wish 😉

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 Author

Waiting for my new post 😀

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 Author

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
barhoumimohamedali profile image
Barhoumimohamedali

thanks , this is really useful!

Collapse
fecocode profile image
Feco

Thanks @hte305 !

Collapse
hte305 profile image
Ha Tuan Em Author

Hope, it helps something to you.

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 :(