---
title: "Discussion on \"How to Deploy a FullStack NodeJs and Express App on Vercel\" | Hashnode"
description: "Discussion on \"How to Deploy a FullStack NodeJs and Express App on Vercel\". A full guide on deploying your fullstack MERN app on Vercel, covering everything from deploying your Express API to connecting it with the frontend"
url: "https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Deploy a FullStack NodeJs and Express App on Vercel](https://vinyldavyl.hashnode.dev/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel?utm_source=hashnode&utm_medium=feed)

A full guide on deploying your fullstack MERN app on Vercel, covering everything from deploying your Express API to connecting it with the frontend

Jun 5, 2023 · 6 min read · vinyldavyl.hashnode.dev  
Read the article

-   [#2articles1week](https://hashnode.com/tag/2articles1week)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#mern](https://hashnode.com/tag/mern)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[Vinyl Davyl](https://hashnode.com/@Vinyl-Davyl)

@Vinyl-Davyl · Lagos State, Nigeria

  
[View profile](https://hashnode.com/@Vinyl-Davyl)

Software Engineer | --- .--. . -. / ... --- ..- .-. -.-. .

Software Engineer building for the web, AI &amp; onchain. Writing about software, systems &amp; the occasional rabbit hole. fn, func and sadly too often; function.

## Responses 8

Markdown supported · ⌘↵ to post

[nasir](https://hashnode.com/@nasir921)

[Jul 6, 2024](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/6688ce8f1f0e74779c11d3a7)

very help full

[Osman Zakir](https://hashnode.com/@DragonOsman)

[Jul 1, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/64a020698db091c401033444)

It's an awesome and very helpfull article.

[Vinyl Davyl](https://hashnode.com/@Vinyl-Davyl)

[Aug 14, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/64a020698db091c401033444#reply-64d9a9736203e95780d62d4f)

Thanks Osman

[Osman Zakir](https://hashnode.com/@DragonOsman)

[Jul 1, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/64a01fec8db091c401033431)

Hi, and thanks for this awesome article.

I have this MERN app I've deployed to Vercel (my GitHub username is DragonOsman. Please go to my GitHub page and go to the personal-library repo; the deployment link is on the right-hand panel). I setup CORS and a proxy (proxy key in client directory package.json that points to the server URL), and the paths and methods are all correct as far as I can see, but I still get a 405 error when I try to send a POST request to my login route.

Source code repository is on my personal-library repository (DragonOsman/personal-library). Any help is appreciated. \[I have to describe like this because I can't post links yet.\] Thanks.

Edit: I removed proxy and only kept CORS, which I'm doing like this:

```
const CLIENT_URL = "<client_url>";

app.use(cors({
  origin: [`${CLIENT_URL}`, `${CLIENT_URL}/`],
  methods: ["GET", "PUT", "POST", "DELETE"],
  credentials: true
}));
```

but I still have a CORS error in my browser's console that says:

```
Access to fetch at '<backend_login_url>' from origin '<client_url>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
```

I added `res.setHeader("Access-Control-Allow-Origin", [CLIENT_URL,`${CLIENT\_URL}/`]);` on all my routes, right at the start of the function code block, and I also added `app.options("*", cors());` (tried it both before and after my `app.use(cors({...}))` call). But that error won't go away. What should I do?

[Vinyl Davyl](https://hashnode.com/@Vinyl-Davyl)

[Aug 14, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/64a01fec8db091c401033431#reply-64d9aac26203e95780d62d6a)

Okay, Hi DragonOsman,

I understand the frustration you're facing with the CORS issue in your MERN app deployed on Vercel. It's great that you've taken steps to set up CORS and proxy settings to allow communication between your frontend and backend.

Sorry for replying this late. But I would try and help as much as I can.

First, make sure that your CORS configuration is correct in both your server and client code. It seems like you've defined the `CLIENT_URL` and added it to the `origin` field in your `app.use(cors(...))` middleware, which is correct. Yeah, but However, the issue might lie in how the headers are being set and how preflight requests are being handled.

I suggest to resolve this issue you check your Server Headers: Make sure that your server is actually sending the `Access-Control-Allow-Origin` header with the correct value (`CLIENT_URL`). It should be sent as a response header when the server receives an OPTIONS request.

Also Check the Handle Preflight Requests: The `app.options("*", cors());` line is correct, and it should come before the `app.use(cors({...}))` middleware. This handles preflight requests, which are used to check the server's CORS policy before making the actual request. Ensure that this setup is in place.

Check, CORS Configuration too Osman. Verify that there are no typos or syntax errors in your CORS configuration. Double-check the URLs and ensure they match your frontend and backend URLs. And even the deployed ones. If you have them deployed on vercel already.

Check your Vercel Configurations and Network Tab Debugging: Check if Vercel has any specific CORS settings that you need to configure. Some hosting platforms have their own CORS configurations that can affect your app. Use your browser's developer tools to inspect the network requests. Check the request and response headers to ensure that the expected CORS headers are present.

This might help, Remember, CORS issues can be tricky, but with careful debugging and attention to detail, you'll likely find a solution. Best of luck, and I hope your app's functionality will be up and running smoothly soon! 🚀 cheers.

[Nwaegidi Wisdom](https://hashnode.com/@Visualhub)

[Jun 22, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/6494603cb5816e3bf5a9b63c)

Nice one!

[Nwaegidi Wisdom](https://hashnode.com/@Visualhub)

[Jun 22, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/64946030f012983651c3257d)

Nice one!

[Vinyl Davyl](https://hashnode.com/@Vinyl-Davyl)

[Jun 23, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/64946030f012983651c3257d#reply-6495de8af012983651c3511c)

Thanks, Glad you liked it

[Samuel Olakada](https://hashnode.com/@olakadasami)

[Jun 13, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/6488c46a06c1659c6d332e9d)

Wow, Thanks alot I'm guessing the vercel.json is quite important for the backend deploy

[Vinyl Davyl](https://hashnode.com/@Vinyl-Davyl)

[Jun 13, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/6488c46a06c1659c6d332e9d#reply-648901e806c1659c6d3333a7)

Yeah!! Glad you liked this. Yeah! really really important. more or less like a corner stone👉👈

[Ifeanyi Thomas](https://hashnode.com/@SirHolmes)

[Jun 11, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/6485617825cdda735201515a)

Thanks for this

[Vinyl Davyl](https://hashnode.com/@Vinyl-Davyl)

[Jun 11, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/6485617825cdda735201515a#reply-6485649125cdda73520151ae)

My pleasure, glad you like

[Akinsola Ademola](https://hashnode.com/@LeviAckerman1)

[Jun 6, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/647f15441147de02efa76cd5)

Thank you for this.

[Vinyl Davyl](https://hashnode.com/@Vinyl-Davyl)

[Jun 6, 2023](https://hashnode.com/posts/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel/647e17cfa786b7ea95559b69/comment/647f15441147de02efa76cd5#reply-647f19accff67d25109eb01e)

My pleasure! Happy you liked this
