Executor

class
 new Executor()  extends Service

Option name Type Description

An Executor is a Service that is designed to handle HTTP request to it
It has output methods to be able to communicate with the client

An executor has several properties set :
body : The request
session : The current session object
_params : like all services (but the parameters from the route definition are added)
_route : The current route used
query : With the query parameters

class Executor extends Service {

execute

method
 Executor.prototype.execute() 

Option name Type Description

Main method called by the webda framework if the route don't specify a _method

execute(ctx) {
	if (typeof(ctx._route._method) === "function") {
		return new Promise( (resolve, reject) => {
			resolve(this[ctx._route._method.name](ctx));
		});
	}
	return Promise.reject(Error("Not implemented"));
}

updateContext

method
 Executor.prototype.updateContext() 

Use this method to enhance the context if needed

updateContext(ctx) {
	ctx.setExecutor(this);
}

getService

method
 Executor.prototype.getService() 

Option name Type Description
name String

of the service

Get a service from webda

getService(name) {
	return this._webda.getService(name);
}
}

module.exports = Executor