const {Responder} = require('./response.dev'); let responder = new Responder(); responder.start(); module.exports = () => ({ '@truss/http-get': async (action) => { const {html, headers} = await responder.respond(action); return { status: 200, headers: { ...defaultResponseHeaders(), ...headers }, response: html, }; }, '@truss/schema': () => ({ executors: ['@truss/http-get'], }), }); function defaultResponseHeaders() { return { date: (new Date()).toUTCString(), connection: 'keep-alive', }; } if (module.hot) { module.hot.accept('./response.dev', () => { responder.stop(); responder = new require('./response.dev').Responder(); responder.start(); }); }