import { IncomingMessage, ServerResponse, Server } from "http"; export default class Mixer { constructor(){ console.log("mixer created"); } http_handler(req: IncomingMessage, res: ServerResponse){ // reject invalid requests if( req.method != 'POST' ){ res.writeHead(200, { 'Content-Type': 'application/json' }) res.end(JSON.stringify({reason: 'invalid HTTP method; only POST allowed'})) }else if( req.url != "/" ){ res.writeHead(200, { 'Content-Type': 'application/json' }) res.end(JSON.stringify({reason: 'invalid URI; only / allowed'})) } res.end(); } }