libflitter/directives/ServerDirective.js

/**
 * @module libflitter/directives/ServerDirective
 */

const Directive = require('flitter-cli/Directive')

/**
 * Provides the Flitter CLI command to launch a normal Flitter HTTP server.
 * @extends module:flitter-cli/Directive~Directive
 */
class ServerDirective extends Directive {
    static get services() {
        return [...super.services, 'output']
    }

    /**
     * Get the name of the directive. Used by ./flitter.
     * @returns {string} "up"
     * @static
     */
    static name(){
        return "up"
    }

    /**
     * Get the help text for the directive. Used by ./flitter help.
     * @returns {string}
     * @static
     */
    static help(){
        return "launch the Flitter server"
    }

    /**
     * Handle an invocation of this directive. Launches the default app target.
     * @param {module:libflitter/app/FlitterApp~FlitterApp} app - the Flitter app
     * @param {Array} argv - list of CLI arguments passed to the directive
     * @returns {Promise<void>}
     */
    async handle(app, argv){
        this.output.error('The server directive is still under construction. Use node index.js instead.')
    }
}

module.exports = exports = ServerDirective