Skip to content

Instantly share code, notes, and snippets.

@bpinedah
Created March 17, 2020 06:17
Show Gist options
  • Save bpinedah/d0af01a8f85a4de3af26dcadc3c35f93 to your computer and use it in GitHub Desktop.
Save bpinedah/d0af01a8f85a4de3af26dcadc3c35f93 to your computer and use it in GitHub Desktop.
Routes article
/**
* @description Resolve function to exit from pipeline
* @param signal Flag to continue or not on pipeline
* @returns {*}
* @private
*/
const _res = signal => () => ({
statusCode: 200,
headers: {},
setHeader: function setHeader(header) {
this.headers = {...this.headers, ...header};
},
send: function send(data) {
signal.continue = false;
return Promise.resolve(resHandler(this.statusCode, data, this.headers));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment