-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update sample poc-subapp-min to fastify
- Loading branch information
Showing
10 changed files
with
17 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"use strict"; | ||
module.exports = { | ||
extends: "@xarc/app-dev/config/babel/babelrc.js" | ||
}; | ||
|
||
module.exports = { | ||
extends: "@xarc/app-dev/config/babel/babelrc.js" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1 @@ | ||
// | ||
// This file is here to allow enabling the plugins inert and electrodeStaticPaths, overriding the | ||
// settings in production.json, in order to serve the static JS and CSS bundle files from | ||
// the dist directory so you can test your app server locally in production mode. | ||
// | ||
// When running in a real production environment where your static files are most likely served | ||
// by a dedicated CDN server, you might want to turn these plugins off. | ||
// | ||
|
||
const serveStaticFiles = () => { | ||
return process.env.STATIC_FILES_OFF !== "true"; | ||
}; | ||
|
||
module.exports = { | ||
"plugins": { | ||
"inert": { | ||
"enable": serveStaticFiles() | ||
}, | ||
"electrodeStaticPaths": { | ||
"enable": serveStaticFiles() | ||
} | ||
} | ||
}; | ||
module.exports = {}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,14 @@ | ||
"use strict"; | ||
|
||
/* eslint-disable global-require */ | ||
|
||
process.on("SIGINT", () => { | ||
process.exit(0); | ||
}); | ||
|
||
const electrodeConfippet = require("electrode-confippet"); | ||
const support = require("@xarc/app/support"); | ||
|
||
// | ||
const electrodeServer = require("@xarc/fastify-server"); | ||
|
||
// | ||
// sample to show electrode server startup events | ||
// https://github.com/electrode-io/electrode-server#listener-function | ||
// | ||
function setupElectrodeServerEvents(emitter) { | ||
emitter.on("config-composed", (data, next) => next()); | ||
emitter.on("server-created", (data, next) => next()); | ||
emitter.on("connection-set", (data, next) => next()); | ||
emitter.on("plugins-sorted", (data, next) => next()); | ||
emitter.on("plugins-registered", (data, next) => next()); | ||
emitter.on("server-started", (data, next) => next()); | ||
emitter.on("complete", (data, next) => next()); | ||
} | ||
|
||
const startServer = config => { | ||
if (!config.listener) config.listener = setupElectrodeServerEvents; | ||
return electrodeServer(config, []); | ||
module.exports = async () => { | ||
await support.load(); | ||
await electrodeServer(electrodeConfippet.config); | ||
}; | ||
|
||
// | ||
|
||
module.exports = () => | ||
support.load().then(() => { | ||
const config = electrodeConfippet.config; | ||
return startServer(config).catch(e => { | ||
console.log("start server failed -", e.message); // eslint-disable-line | ||
process.exit(1); | ||
}); | ||
}); | ||
|
||
if (require.main === module) { | ||
module.exports(); | ||
} |