Expose API routes with Express when deployed on Netlify Expose API routes with Express when deployed on Netlify express express

Expose API routes with Express when deployed on Netlify


Netlify is for static file hosting - you can't deploy an Express application to it, only your frontend. You'll need to use a different service (such as DigitalOcean or Heroku) for your API hosting. You could potentially then route traffic to that API server via Netlify using redirects if you want to use their CDN for response caching.

Edit: This is no longer entirely true - Netlify now also has support for deploying AWS Lambda functions, allowing JavaScript and Go to be run on the server-side.


With Netlify's addition of support AWS Lamdba functions earlier this year, this is actually quite possible now. Here are some resources for those who find this question now.

https://www.netlify.com/docs/functions/

https://www.netlify.com/blog/2018/09/13/how-to-run-express.js-apps-with-netlify-functions/