Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- /**
- * $ nvm use 8
- * $ npm i koa request
- */
- const Koa = require('koa');
- const app = new Koa();
- const request = require('request');
- const DOC_URL = process.argv[2];
- app.use(async ctx => {
- ctx.body =
- request.get(DOC_URL)
- .on('response', function(response) {
- console.log('statusCode:', response.statusCode);
- console.log('content-type:', response.headers['content-type']);
- });
- });
- app.listen(3001, () => {
- console.log('listening ...');
- });
Add Comment
Please, Sign In to add comment