add nuxt module to initialize gancio
This commit is contained in:
@@ -56,7 +56,7 @@ module.exports = {
|
|||||||
// Doc: https://axios.nuxtjs.org/usage
|
// Doc: https://axios.nuxtjs.org/usage
|
||||||
'./@nuxtjs/axios',
|
'./@nuxtjs/axios',
|
||||||
'./@nuxtjs/auth',
|
'./@nuxtjs/auth',
|
||||||
['nuxt-express-module', { expressPath: 'server/', routesPath: 'server/routes' }]
|
// ['nuxt-express-module', { expressPath: 'server/', routesPath: 'server/routes' }]
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -95,7 +95,9 @@ module.exports = {
|
|||||||
|
|
||||||
buildModules: [
|
buildModules: [
|
||||||
'nuxt-build-optimisations',
|
'nuxt-build-optimisations',
|
||||||
'@nuxtjs/vuetify'
|
'@nuxtjs/vuetify',
|
||||||
|
['nuxt-express-module', { expressPath: 'server/', routesPath: 'server/routes' }],
|
||||||
|
'@/plugins/initialize.server.js'
|
||||||
],
|
],
|
||||||
vuetify: {
|
vuetify: {
|
||||||
defaultAssets: false,
|
defaultAssets: false,
|
||||||
|
|||||||
27
plugins/initialize.server.js
Normal file
27
plugins/initialize.server.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
export default function () {
|
||||||
|
function start (nuxt) {
|
||||||
|
const log = require('../server/log')
|
||||||
|
const config = require('../server/config')
|
||||||
|
let TaskManager
|
||||||
|
if (!config.firstrun) {
|
||||||
|
TaskManager = require('../server/taskManager').TaskManager
|
||||||
|
TaskManager.start()
|
||||||
|
}
|
||||||
|
const msg = `Listen on ${config.server.host}:${config.server.port} , visit me here => ${config.baseurl}`
|
||||||
|
log.info(msg)
|
||||||
|
|
||||||
|
// close connections/port/unix socket
|
||||||
|
async function shutdown () {
|
||||||
|
if (TaskManager) { TaskManager.stop() }
|
||||||
|
nuxt.close(async () => {
|
||||||
|
log.info('Closing DB')
|
||||||
|
const sequelize = require('../server/api/models')
|
||||||
|
await sequelize.close()
|
||||||
|
process.exit()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
process.on('SIGTERM', shutdown)
|
||||||
|
process.on('SIGINT', shutdown)
|
||||||
|
}
|
||||||
|
this.nuxt.hook('ready', start)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user