- add plugin system that request may included to run before do actual request by type. Signed-off-by: Pakin <pakin.t@forth.co.th>
18 lines
No EOL
450 B
JavaScript
18 lines
No EOL
450 B
JavaScript
export const handler = {
|
|
processMessage(input) {
|
|
// input should be { type_w: "...", "payload": { plugin: "", ... } }
|
|
let n_input = JSON.parse(input);
|
|
console.log(`processing: ${input}`);
|
|
try {
|
|
// delete n_input["payload"]["plugin"];
|
|
return JSON.stringify({
|
|
type_w: n_input.type,
|
|
payload: n_input.payload
|
|
});
|
|
} catch (e) {
|
|
return `JSERROR: ${e.message}\nStack: ${e.stack}`;
|
|
}
|
|
|
|
|
|
}
|
|
}; |