sphinx-software / fusion

Fusion Application Skeleton
MIT License
7 stars 2 forks source link

Kernel based service bootstrap #3

Closed monkey-programmer closed 6 years ago

monkey-programmer commented 6 years ago

Some HTTP only services Session, View are bootstrapped along with some Console only services (mostly ConsoleCommand). This is causing extra overhead

Concepts:

// In the provider.js
exports.register = async (container) => {
    // Using nomarly
}

exports.boot = async (container) => {
    // Will use this method for general booting
}

exports.httpBoot = async (container) => {
    // Only boot in HTTP
}

exports.consoleBoot = async (container) => {
    // Only boot in Console
}

exports.socketBoot = async (container) => {
    // Only boot in Socket
}

Especially for the HTTP case, we'll let the bootstrap sequence run inside a middleware. So in the httpBoot, we can also have access to the Koa context. Which will also help us on improving the Auth service architecture

monkey-programmer commented 6 years ago

Okay, we won't do that. At least for v1.0, it's too complicated for the user to knowing if his/her service is needed for a kernel or not.

Beside, it's not a performance penalty 👎