diff --git a/doc/api/vm.md b/doc/api/vm.md index aa36319ac20ffc..288dcaf9e383d1 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -442,18 +442,17 @@ to the `http` module passed to it. For instance: 'use strict'; const vm = require('vm'); -const code = -`(function(require) { +const code = ` +(function(require) { + const http = require('http'); - const http = require('http'); + http.createServer((request, response) => { + response.writeHead(200, { 'Content-Type': 'text/plain' }); + response.end('Hello World\\n'); + }).listen(8124); - http.createServer( (request, response) => { - response.writeHead(200, {'Content-Type': 'text/plain'}); - response.end('Hello World\\n'); - }).listen(8124); - - console.log('Server running at http://127.0.0.1:8124/'); - })`; + console.log('Server running at http://127.0.0.1:8124/'); +})`; vm.runInThisContext(code)(require); ```