How to use nuxt-edge - 10 common examples

To help you get started, we’ve selected a few nuxt-edge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nuxt / create-nuxt-app / template / frameworks / feathers / server / middleware / nuxt.js View on Github external
const resolve = require('path').resolve
const { Nuxt, Builder } = require('nuxt-edge')

// Setup nuxt.js
let config = {}
try {
  config = require('../../nuxt.config.js')
} catch (e) {}
config.rootDir = resolve(__dirname, '..', '..')
config.dev = process.env.NODE_ENV !== 'production'

const nuxt = new Nuxt(config)
if (config.dev) {
  const builder = new Builder(nuxt)
  builder.build().then(() => process.emit('nuxt:build:done'))
} else {
  process.nextTick(() => process.emit('nuxt:build:done'))
}

// Add nuxt.js middleware
module.exports = function (req, res) {
  nuxt.render(req, res)
}
github nuxt / create-nuxt-app / template / frameworks / feathers / server / middleware / nuxt.js View on Github external
const resolve = require('path').resolve
const { Nuxt, Builder } = require('nuxt-edge')

// Setup nuxt.js
let config = {}
try {
  config = require('../../nuxt.config.js')
} catch (e) {}
config.rootDir = resolve(__dirname, '..', '..')
config.dev = process.env.NODE_ENV !== 'production'

const nuxt = new Nuxt(config)
if (config.dev) {
  const builder = new Builder(nuxt)
  builder.build().then(() => process.emit('nuxt:build:done'))
} else {
  process.nextTick(() => process.emit('nuxt:build:done'))
}

// Add nuxt.js middleware
module.exports = function (req, res) {
  nuxt.render(req, res)
}
github nuxt / create-nuxt-app / template / frameworks / micro / server / micro.config.js View on Github external
const dispatch = require('micro-route/dispatch')
const { Nuxt, Builder } = require('nuxt-edge')

// Require nuxt config
const config = require('../nuxt.config.js')
// Create a new nuxt instance
const nuxt = new Nuxt(config)
// Enable live build & reloading on dev
if (nuxt.options.dev) {
  new Builder(nuxt).build()
}

module.exports = async (req, res) => {
  await dispatch()
    .dispatch('*', ['GET'], (req, res) => nuxt.render(req, res))(req, res)
}
github nuxt / create-nuxt-app / template / frameworks / micro / server / micro.config.js View on Github external
const dispatch = require('micro-route/dispatch')
const { Nuxt, Builder } = require('nuxt-edge')

// Require nuxt config
const config = require('../nuxt.config.js')
// Create a new nuxt instance
const nuxt = new Nuxt(config)
// Enable live build & reloading on dev
if (nuxt.options.dev) {
  new Builder(nuxt).build()
}

module.exports = async (req, res) => {
  await dispatch()
    .dispatch('*', ['GET'], (req, res) => nuxt.render(req, res))(req, res)
}
github nuxt / http / test / _utils.js View on Github external
async function setupMockNuxt (config) {
  const nuxt = new Nuxt({
    ...defaultConfig,
    ...config,
    _ready: false
  })

  nuxt.moduleContainer.addTemplate = jest.fn(nuxt.moduleContainer.addTemplate)

  await nuxt.ready()

  const builder = new Builder(nuxt)

  await builder.validatePages()
  await builder.generateRoutesAndFiles()
  nuxt.builder = builder

  return nuxt
github chanlito / nuxt-ts-module / test / index.js View on Github external
before(async () => {
    nuxtConfig.typescript.cache = '';
    nuxtConfig.typescript.thread = '';
    nuxtConfig.typescript.checker = false;
    nuxt = new Nuxt(nuxtConfig);
    await new Builder(nuxt).build();
    nuxt.listen(4000);
  });
github nuxt / http / test / _utils.js View on Github external
async function setupNuxt (config) {
  const nuxt = new Nuxt({
    ...defaultConfig,
    ...config,
    _ready: false
  })

  jest.spyOn(nuxt.moduleContainer, 'addTemplate')

  await nuxt.ready()

  const builder = new Builder(nuxt)
  nuxt.builder = builder

  return nuxt
}
github chanlito / nuxt-ts-module / test / index.js View on Github external
before(async () => {
    nuxtConfig.typescript = {
      cache: true,
      thread: true,
      checker: false,
      loader: { tsconfig: resolve('.', 'tsconfig.default.json') },
    };
    nuxt = new Nuxt(nuxtConfig);
    await new Builder(nuxt).build();
    nuxt.listen(4000);
  });
github nuxt / http / test / _utils.js View on Github external
async function setupNuxt (config) {
  const nuxt = new Nuxt({
    ...defaultConfig,
    ...config,
    _ready: false
  })

  jest.spyOn(nuxt.moduleContainer, 'addTemplate')

  await nuxt.ready()

  const builder = new Builder(nuxt)
  nuxt.builder = builder

  return nuxt
}
github nuxt / http / test / _utils.js View on Github external
async function setupMockNuxt (config) {
  const nuxt = new Nuxt({
    ...defaultConfig,
    ...config,
    _ready: false
  })

  nuxt.moduleContainer.addTemplate = jest.fn(nuxt.moduleContainer.addTemplate)

  await nuxt.ready()

  const builder = new Builder(nuxt)

  await builder.validatePages()
  await builder.generateRoutesAndFiles()
  nuxt.builder = builder

  return nuxt
}

nuxt-edge

A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)

MIT
Latest version published 6 months ago

Package Health Score

77 / 100
Full package analysis

Popular nuxt-edge functions