@softvisio/core
Version:
Softisio core
59 lines (48 loc) • 1.43 kB
JavaScript
import Api from "#lib/api";
export default class Services {
constructor ( app, config ) {
this.
this.
}
// properties
get app () {
return this.
}
// public
async init () {
for ( const [ name, options ] of Object.entries( this.
let service;
try {
if ( typeof options === "string" ) {
service = new Api( options );
}
else if ( options.import ) {
const { "default": Service } = await import( import.meta.resolve( options.import ) );
if ( options.arguments ) {
service = new Service( ...options.arguments );
}
else {
service = new Service( ...options.options );
}
}
else {
service = new Api( options.url, options.options );
}
}
catch ( e ) {
return result.catch( e );
}
this.
}
return result( 200 );
}
has ( name ) {
return this.
}
get ( name ) {
return this.
}
}