http.createServer((req, res) => { if (req.url === '/favicon.ico') { res.writeHead(200, { 'Content-Type': 'image/x-icon' }); return res.end(''); } return tailor.requestHandler(req, res); })
// Root Server http .createServer((req, res) => { if (req.url === '/favicon.ico') { res.writeHead(200, { 'Content-Type': 'image/x-icon' }); return res.end(''); } tailor.requestHandler(req, res); }) .listen(8080, function() { console.log('Tailor server listening on port 8080'); });
}); server = http.createServer((req, res) => { if (req.url === '/favicon.ico') { res.writeHead(200, { 'Content-Type': 'image/x-icon' }); return res.end('');
const urlObj = url.parse(req.url, true);
app.use(ctx => { if (ctx.req.url !== '/keep-alive') { ctx.set('Connection', 'close'); } ctx.body = 'Hello World!'; });
http.createServer((req, res) => { const { pathname } = url.parse(req.url); console.log('>>>>>>>>route', pathname); if (pathname === '/nike.html') { const buffer = fs.readFileSync(path.join(__dirname, 'bankroll.json')); console.log('>>>>>>>>>>>buffer length', buffer.length); // res.setHeader('content-encoding', 'br'); res.removeHeader('content-length'); res.setHeader('content-type', 'application/json'); res.write(buffer); } res.end(); })
http.createServer((request, response) => { console.log('request to upstream service'); const { pathname } = url.parse(request.url); if (pathname.includes('repo')) { const req = http.request({
http.createServer((req, res) => { if (req.url !== '/keep-alive') { res.setHeader('Connection', 'close'); } res.setHeader('Content-Length', '12'); res.end('Hello World!'); }).listen(8000);
http.createServer((req, res) => { if (req.url !== '/keep-alive') { res.writeHead('Connection', 'close'); } res.end('Hello World!'); }).listen(8000);
// Root Server http .createServer((req, res) => { if (req.url === '/favicon.ico') { res.writeHead(200, { 'Content-Type': 'image/x-icon' }); return res.end(''); } tailor.requestHandler(req, res); }) .listen(8080, function() { console.log('Tailor server listening on port 8080'); });
http.createServer((req, res) => { if (req.url === '/favicon.ico') { res.writeHead(200, { 'Content-Type': 'image/x-icon' }); return res.end(''); } return tailor.requestHandler(req, res); })
app.use(ctx => { if (ctx.req.url !== '/keep-alive') { ctx.set('Connection', 'close'); } ctx.body = 'Hello World!'; });