Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port was hardcoded with serve command and SSR #1092

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/src/commands/serve.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getStaticServer, getHybridServer } from '../lifecycles/serve.js';
import { checkResourceExists } from '@greenwood/cli/src/lib/resource-utils.js';
import { checkResourceExists } from '../lib/resource-utils.js';

const runProdServer = async (compilation) => {

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/lifecycles/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ async function getStaticServer(compilation, composable) {
}

async function getHybridServer(compilation) {
const { graph, manifest, context } = compilation;
const { graph, manifest, context, config } = compilation;
const { outputDir } = context;
const app = await getStaticServer(compilation, true);

app.use(async (ctx) => {
try {
const url = new URL(`http://localhost:8080${ctx.url}`);
const url = new URL(`http://localhost:${config.port}${ctx.url}`);
const matchingRoute = graph.find((node) => node.route === url.pathname) || { data: {} };
const isApiRoute = manifest.apis.has(url.pathname);
const request = new Request(url.href, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
interpolateFrontmatter: true
port: 8181
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
* greenwood build
*
* User Config
* None
* {
* port: 8181
* }
*
* User Workspace
* src/
Expand Down Expand Up @@ -40,7 +42,7 @@ describe('Serve Greenwood With: ', function() {
const LABEL = 'A Server Rendered Application (SSR)';
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = fileURLToPath(new URL('.', import.meta.url));
const hostname = 'http://127.0.0.1:8080';
const hostname = 'http://127.0.0.1:8181';
let runner;

before(async function() {
Expand Down