diff --git a/README.md b/README.md index 87106e4..d4b2758 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ $ npm test This simple example will send a specific file to all requests. ```js -var http = require('http') +var http = require('node:http') var send = require('send') var server = http.createServer(function onRequest (req, res) { @@ -191,7 +191,7 @@ given directory as the top-level. For example, a request `GET /foo.txt` will send back `/www/public/foo.txt`. ```js -var http = require('http') +var http = require('node:http') var parseUrl = require('parseurl') var send = require('@fastify/send') @@ -206,7 +206,7 @@ server.listen(3000) ### Custom file types ```js -var http = require('http') +var http = require('node:http') var parseUrl = require('parseurl') var send = require('@fastify/send') @@ -232,8 +232,8 @@ This is an example of serving up a structure of directories with a custom function to render a listing of a directory. ```js -var http = require('http') -var fs = require('fs') +var http = require('node:http') +var fs = require('node:fs') var parseUrl = require('parseurl') var send = require('@fastify/send') @@ -270,7 +270,7 @@ function directory (res, path) { ### Serving from a root directory with custom error-handling ```js -var http = require('http') +var http = require('node:http') var parseUrl = require('parseurl') var send = require('@fastify/send') diff --git a/examples/simple.js b/examples/simple.js index e9e3614..2c79119 100644 --- a/examples/simple.js +++ b/examples/simple.js @@ -1,8 +1,8 @@ 'use strict' -const http = require('http') +const http = require('node:http') const send = require('..') -const path = require('path') +const path = require('node:path') const indexPath = path.join(__dirname, 'index.html') diff --git a/test/SendStream-pipe.test.js b/test/SendStream-pipe.test.js index 6967ed0..0c58fa9 100644 --- a/test/SendStream-pipe.test.js +++ b/test/SendStream-pipe.test.js @@ -2,11 +2,11 @@ const { test } = require('tap') const after = require('after') -const http = require('http') -const path = require('path') +const http = require('node:http') +const path = require('node:path') const request = require('supertest') const SendStream = require('../lib/SendStream') -const os = require('os') +const os = require('node:os') const { shouldNotHaveBody, createServer, shouldNotHaveHeader } = require('./utils') const dateRegExp = /^\w{3}, \d+ \w+ \d+ \d+:\d+:\d+ \w+$/ diff --git a/test/SendStream.test.js b/test/SendStream.test.js index b86dc51..fc5c1c1 100644 --- a/test/SendStream.test.js +++ b/test/SendStream.test.js @@ -1,9 +1,9 @@ 'use strict' const { test } = require('tap') -const fs = require('fs') -const http = require('http') -const path = require('path') +const fs = require('node:fs') +const http = require('node:http') +const path = require('node:path') const request = require('supertest') const SendStream = require('..').SendStream const { shouldNotHaveHeader, createServer } = require('./utils') diff --git a/test/mime.test.js b/test/mime.test.js index f93641c..476c293 100644 --- a/test/mime.test.js +++ b/test/mime.test.js @@ -1,7 +1,7 @@ 'use strict' const { test } = require('tap') -const path = require('path') +const path = require('node:path') const request = require('supertest') const send = require('..') const { shouldNotHaveHeader, createServer } = require('./utils') diff --git a/test/utils.js b/test/utils.js index 923905f..218d38f 100644 --- a/test/utils.js +++ b/test/utils.js @@ -1,6 +1,6 @@ 'use strict' -const http = require('http') +const http = require('node:http') const send = require('..') module.exports.shouldNotHaveHeader = function shouldNotHaveHeader (header, t) {