uptownhr / nuxt-express-module

Add express routes to your nuxt app
MIT License
61 stars 4 forks source link
express nuxtjs vue

nuxt-express-module

npm (scoped with tag) npm CircleCI Codecov Dependencies js-standard-style

Depricated

Everyone, I do not recommend using this module. This is no longer maintained and probably broken. I also recommend checking https://nuxtjs.org/api/configuration-servermiddleware/#usage, as Nuxt provides this as a baked in feature.

📖 Release Notes

Features

Provides express and express/routes directory to write express routes within nuxt. The module will watch for all files within the express directory for changes and hot-reload without taking down the entire nuxt server.

Setup

{
  modules: [
    // Simple usage
    'nuxt-express-module',

    // With options
    ['nuxt-express-module', { /* module options */ }],
 ]
}
// express/routes/index.js sample
const {Router} = require('express')
const router = Router()

router.get('/api/test', (req, res) => {
  res.send('hello')
})

module.exports = router

Options

expressPath

Overrides the default path of where the express directory is

routesPath

Overrides the default path of where express/routes/index.js is located

Usage

Module Description

Development

License

MIT License

Copyright (c) James Lee uptownhr@gmail.com