Skip to content

Commit a72fafc

Browse files
committed
feat: add default index file and API server configuration for Angular Hub
1 parent 4548883 commit a72fafc

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

angular.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818
"builder": "@angular/build:application",
1919
"options": {
2020
"browser": "src/main.ts",
21+
"index": "src/indexDefault.html",
2122
"tsConfig": "tsconfig.app.json",
2223
"assets": [
2324
{
2425
"glob": "**/*",
2526
"input": "public"
2627
}
2728
],
28-
"styles": [
29-
"src/styles.css"
30-
],
29+
"styles": ["src/styles.css"],
3130
"server": "src/main.server.ts",
3231
"outputMode": "server",
3332
"ssr": {
@@ -83,9 +82,7 @@
8382
"input": "public"
8483
}
8584
],
86-
"styles": [
87-
"src/styles.css"
88-
]
85+
"styles": ["src/styles.css"]
8986
}
9087
}
9188
}

api/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const path = require("path");
2+
3+
const serverDistPath = path.join(
4+
process.cwd(),
5+
"dist/angular-hub/server/server.mjs",
6+
);
7+
8+
export default import(serverDistPath).then((module) => module.reqHandler);
File renamed without changes.

src/server.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@ const browserDistFolder = join(import.meta.dirname, '../browser');
2222
const app = express();
2323
const angularApp = new AngularNodeAppEngine();
2424

25-
/**
26-
* Example Express Rest API endpoints can be defined here.
27-
* Uncomment and define endpoints as necessary.
28-
*
29-
* Example:
30-
* ```ts
31-
* app.get('/api/{*splat}', (req, res) => {
32-
* // Handle API request
33-
* });
34-
* ```
35-
*/
36-
3725
// API Routes
3826
app.get('/api/v1/podcasts', async (req, res) => {
3927
try {

vercel.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 2,
3+
"public": true,
4+
"name": "angular-hub",
5+
"rewrites": [{ "source": "/(.*)", "destination": "/api" }],
6+
"functions": {
7+
"api/index.js": {
8+
"includeFiles": "dist/angular-hub/**"
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)