Skip to content

Nuxt.js example for running Netlify functions locally in a dev environment and as a generated static site deployed to Netlify

License

Notifications You must be signed in to change notification settings

cfab/nuxt-netlify-functions-example

 
 

Repository files navigation

nuxt-netlify-functions-example

Netlify Status

Nuxt.js example for running Netlify functions locally in a dev environment and as a generated static site deployed to Netlify.

Heavily inspired by the official guide and this example.

Demo

Live demo can be found here.

Info

For the requests on the client side we use the Axios Module. To proxy locally you have to set up the Proxy Module in nuxt.config.js:

proxy: {
  '/.netlify': {
    target: 'http://localhost:9000',
    pathRewrite: { '^/.netlify/functions': '' }
  }
}

Build Setup

# Use nvm
$ nvm use

# Install dependencies
$ yarn

# Build lambda functions locally
$ yarn netlify-lambda build netlify-lambda-src

# Serve lambda functions locally
$ yarn netlify-lambda serve netlify-lambda-src

# Serve nuxt app with hot reload at localhost:3000
$ yarn dev

# Generate static project
$ yarn generate

About

Nuxt.js example for running Netlify functions locally in a dev environment and as a generated static site deployed to Netlify

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vue 63.5%
  • JavaScript 34.7%
  • CSS 1.8%