diff --git a/README.md b/README.md index c9d1870..84578e9 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Specify an install command. Defaults to `npm install`. ### `port: number` -Specify a port for the Next.js server. Defaults to `3000`. +Specify a port for the Next.js server. Defaults to `9926`. ### `prebuilt: boolean` diff --git a/extension.js b/extension.js index fa7bf8c..0ffe27c 100644 --- a/extension.js +++ b/extension.js @@ -13,7 +13,8 @@ import shellQuote from 'shell-quote'; * @property {string=} buildOnly - Build the Next.js app and exit. Defaults to `false`. * @property {boolean=} dev - Enable dev mode. Defaults to `false`. * @property {string=} installCommand - A custom install command. Defaults to `npm install`. - * @property {number=} port - A port for the Next.js server. Defaults to `3000`. + * @property {number=} port - A port for the Next.js server. Defaults to the HarperDB HTTP Port. + * @property {number=} securePort - A (secure) port for the https Next.js server. Defaults to the HarperDB HTTPS Secure Port. * @property {boolean=} prebuilt - Instruct the extension to skip executing the `buildCommand`. Defaults to `false`. * @property {string=} subPath - A sub path for serving request from. Defaults to `''`. */ @@ -59,6 +60,7 @@ function resolveConfig(options) { assertType('dev', options.dev, 'boolean'); assertType('installCommand', options.installCommand, 'string'); assertType('port', options.port, 'number'); + assertType('securePort', options.securePort, 'number'); assertType('prebuilt', options.prebuilt, 'boolean'); assertType('subPath', options.subPath, 'string'); @@ -75,7 +77,8 @@ function resolveConfig(options) { buildOnly: options.buildOnly ?? false, dev: options.dev ?? false, installCommand: options.installCommand ?? 'npm install', - port: options.port ?? 3000, + port: options.port, + securePort: options.securePort, prebuilt: options.prebuilt ?? false, subPath: options.subPath ?? '', cache: options.cache ?? false, @@ -291,7 +294,7 @@ export function start(options = {}) { : nodeRequest.url; return requestHandler(nodeRequest, request._nodeResponse, url.parse(nodeRequest.url, true)); }, - { port: config.port } + { port: config.port, securePort: config.securePort } ); if (config.dev) { diff --git a/fixtures/next-13/config.yaml b/fixtures/next-13/config.yaml index 9cc50d3..c0f2cb6 100644 --- a/fixtures/next-13/config.yaml +++ b/fixtures/next-13/config.yaml @@ -1,4 +1,3 @@ '@harperdb/nextjs': package: '@harperdb/nextjs' files: '/*' - port: 9926 diff --git a/fixtures/next-14/config.yaml b/fixtures/next-14/config.yaml index 9cc50d3..c0f2cb6 100644 --- a/fixtures/next-14/config.yaml +++ b/fixtures/next-14/config.yaml @@ -1,4 +1,3 @@ '@harperdb/nextjs': package: '@harperdb/nextjs' files: '/*' - port: 9926 diff --git a/fixtures/next-15/config.yaml b/fixtures/next-15/config.yaml index 9cc50d3..c0f2cb6 100644 --- a/fixtures/next-15/config.yaml +++ b/fixtures/next-15/config.yaml @@ -1,4 +1,3 @@ '@harperdb/nextjs': package: '@harperdb/nextjs' files: '/*' - port: 9926