Skip to content

Instantly share code, notes, and snippets.

@fernyettheplant
Created April 14, 2018 21:57
Show Gist options
  • Save fernyettheplant/2a487947818c792078ab0cfa7ccd2b5d to your computer and use it in GitHub Desktop.
Save fernyettheplant/2a487947818c792078ab0cfa7ccd2b5d to your computer and use it in GitHub Desktop.
const express = require('express')
const {Nuxt} = require('nuxt')
const path = require('path')
const awsServerlessExpressMiddleware = require('aws-serverless-express/middleware')
// Create App
const app = express()
// Set API Gateway Middleware
app.use(awsServerlessExpressMiddleware.eventContext())
// Provide Assets
app.use('/_nuxt', express.static(path.join(__dirname, '.nuxt', 'dist')))
// Add Nuxt
let config = require('./nuxt.config.js')
const nuxt = new Nuxt(config)
app.use(nuxt.render)
module.exports = app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment