Skip to content

Commit b75f803

Browse files
committed
fix(): all
1 parent 58f4b82 commit b75f803

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

doc-angular/api/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
export default import('../dist/server/server.mjs').then((module) =>
2-
module.app(),
3-
);
1+
const path = require('path');
2+
3+
const serverDistPath = path.join(process.cwd(), 'dist/server/server.mjs');
4+
5+
export default import(serverDistPath).then((module) => module.app);

doc-angular/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"outputs": ["{options.outputPath}"],
1212
"options": {
1313
"outputPath": "doc-angular/dist",
14-
"index": "doc-angular/src/index1.html",
14+
"index": "doc-angular/src/indexFile.html",
1515
"browser": "doc-angular/src/main.ts",
1616
"tsConfig": "doc-angular/tsconfig.app.json",
1717
"inlineStyleLanguage": "scss",

doc-angular/src/server.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
AngularNodeAppEngine,
33
createNodeRequestHandler,
4+
isMainModule,
45
writeResponseToNodeResponse,
56
} from '@angular/ssr/node';
67
import express from 'express';
@@ -10,7 +11,7 @@ import { fileURLToPath } from 'node:url';
1011
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
1112
const browserDistFolder = resolve(serverDistFolder, '../browser');
1213

13-
const app = express();
14+
export const app = express();
1415
const angularApp = new AngularNodeAppEngine();
1516

1617
/**
@@ -52,12 +53,12 @@ app.use('/**', (req, res, next) => {
5253
* Start the server if this module is the main entry point.
5354
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
5455
*/
55-
// if (isMainModule(import.meta.url)) {
56-
// const port = process.env['PORT'] || 4000;
57-
// app.listen(port, () => {
58-
// console.log(`Node Express server listening on http://localhost:${port}`);
59-
// });
60-
// }
56+
if (isMainModule(import.meta.url)) {
57+
const port = process.env['PORT'] || 4000;
58+
app.listen(port, () => {
59+
console.log(`Node Express server listening on http://localhost:${port}`);
60+
});
61+
}
6162

6263
/**
6364
* Request handler used by the Angular CLI (for dev-server and during build) or Firebase Cloud Functions.

0 commit comments

Comments
 (0)