Skip to content

Commit 6742325

Browse files
committed
rename http/server -> http/static
1 parent d688683 commit 6742325

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

doc/api/http.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,20 +3241,20 @@ request will be blocked.
32413241
If `port` is omitted or is 0, the operating system will assign an arbitrary
32423242
unused port, which it's output will be the standard output.
32433243

3244-
Also accessible via `require('node:http/server')`.
3244+
Also accessible via `require('node:http/static')`.
32453245

32463246
```bash
32473247
# Starts serving the cwd on a random port:
3248-
node -r node:http/server
3248+
node -r node:http/static
32493249
node -e 'http.createStaticServer()'
32503250

32513251
# To start serving on the port 8080 using /path/to/dir as the root:
3252-
node -r node:http/server /path/to/dir --port 8080
3252+
node -r node:http/static /path/to/dir --port 8080
32533253
node -e 'http.createStaticServer({directory: "/path/to/dir", port: 8080})'
32543254

32553255
# Same as above, but exposing your local file system to the whole
32563256
# IPv4 network:
3257-
node -r node:http/server /path/to/dir --port 8080 --host 0.0.0.0
3257+
node -r node:http/static /path/to/dir --port 8080 --host 0.0.0.0
32583258
node -e 'http.createStaticServer({directory: "/path/to/dir", port: 8080, host: "0.0.0.0"})'
32593259
```
32603260

lib/http.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const {
4343
Server,
4444
ServerResponse
4545
} = require('_http_server');
46-
const createStaticServer = require('http/server');
46+
const createStaticServer = require('http/static');
4747
let maxHeaderSize;
4848

4949
/**

lib/http/server.js renamed to lib/http/static.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ const { emitExperimentalWarning, kEmptyObject } = require('internal/util');
2323
const { getOptionValue } = require('internal/options');
2424
const { validateFunction, validatePort } = require('internal/validators');
2525

26-
emitExperimentalWarning('http/server');
27-
2826
if (module.isPreloading) {
2927
const requiredModules = getOptionValue('--require');
3028
if (ArrayPrototypeIncludes(requiredModules, `node:${module.id}`) ||
@@ -41,8 +39,8 @@ if (module.isPreloading) {
4139
},
4240
} });
4341
nextTick(createStaticServer, { directory: process.argv[1], port, host });
44-
process.env.NODE_REPL_EXTERNAL_MODULE = 'node:http/server';
45-
process.argv[1] = 'node:http/server';
42+
process.env.NODE_REPL_EXTERNAL_MODULE = 'node:http/static';
43+
process.argv[1] = 'node:http/static';
4644
}
4745
}
4846

@@ -51,6 +49,8 @@ function filterDotFiles(url, fileURL) {
5149
}
5250

5351
function createStaticServer(options = kEmptyObject) {
52+
emitExperimentalWarning('http/static');
53+
5454
const {
5555
directory = cwd(),
5656
port,

test/parallel/test-http-createstaticserver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { mustCall } = require('../common');
33
const fixtures = require('../common/fixtures');
44
const assert = require('node:assert');
55
const { MIMEType } = require('node:util');
6-
const createStaticServer = require('node:http/server');
6+
const createStaticServer = require('node:http/static');
77

88
[0, 1, 1n, '', '1', true, false, NaN, Symbol(), {}, []].forEach((filter) => {
99
assert.throws(() => createStaticServer({ filter }), { code: 'ERR_INVALID_ARG_TYPE' });

0 commit comments

Comments
 (0)