/Netlify-MVC-App

An example of how to host an Express.js app on Netlify using serverless-http.

Primary LanguageHTMLApache License 2.0Apache-2.0

Express.js on Netlify Example

Deploy to Netlify

An example of how to host an Express.js app on Netlify using serverless-http. See express/server.js for details, or check it out at https://pedantic-goldberg-8ee2d8.netlify.com/!

index.html simply loads html from the Express.js app using <object>, and the app is hosted at /.netlify/functions/server. Examples of how to access the Express.js endpoints:

curl https://netlify-express.netlify.com/.netlify/functions/server
curl https://netlify-express.netlify.com/.netlify/functions/server/another
curl --header "Content-Type: application/json" --request POST --data '{"json":"POST"}' https://netlify-express.netlify.com/.netlify/functions/server

Pug on Netlify

Pug isn't supported on Netlify. Use pug-cli to compile pug into html.

npm install pug-cli
node node_modules/pug-cli/index.js pug/ --out ./views

Use npm pug to accomplish the same conversion.

MVC on Netlify

Netlify does not support redirects.