@w3cub/nuxt-express-module
v0.0.25
Published
[![npm (scoped with tag)](https://img.shields.io/npm/v/@w3cub/nuxt-express-module/latest.svg?style=flat-square)](https://npmjs.com/package/@w3cub/nuxt-express-module) [![npm](https://img.shields.io/npm/dt/@w3cub/nuxt-express-module.svg?style=flat-square)]
Downloads
4
Readme
nuxt-express-module
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
- Add
@w3cub/nuxt-express-module
dependency using yarn or npm to your project - Add
@w3cub/nuxt-express-module
tomodules
section ofnuxt.config.js
{
modules: [
// Simple usage
'@w3cub/nuxt-express-module',
// With options
['@w3cub/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
setupPath
Overrides the default path of where the express app file is
routesPath
Overrides the default path of where express/routes/index.js is located
Usage
Module Description
Development
- Clone this repository
- Install dependnecies using
yarn install
ornpm install
- Start development server using
npm run dev
License
Copyright (c) James Lee [email protected] Terry Cai [email protected]