Giter VIP home page Giter VIP logo

2023-06--netlify-express-fork's Introduction

Express.js on Netlify Example

Deploy to Netlify

An example of how to host an Express.js app on Netlify using serverless-http. See How to run Express.js apps with Netlify Functions for details.

index.pug simply loads html from the Express.js app using <object>, and the app is hosted at /.netlify/functions/server.

Demo

Check out a working demo of this application at my custom Netlify link.

Get started on Netlify-Express App locally

The most recent information from 2018 confirms that Netlify does not support sub-folders (though there is discussion about adding it to the UI). Therefore all of your project files must exist in the root. It should be noted that while your Netlify routes exist inserver.js, your local routes exist as separate files in the routes subdirectory. Any changes in these files during development must be manually changed in the server.js file to take effect on Netlify.

To get started, ensure you have Node.js installed, then:

npm install
npm start

Entry Point

server-local.js is our entry point. If you have nodemon, run:

nodemon server-local.js

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

Be sure the build command on Netlify includes the PUG conversion (set in the `netlify.toml file):

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

Contributors



License & copyright

© 2019 Ethan Miller

2023-06--netlify-express-fork's People

Contributors

ethanmiller1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.