From 7310ec1d681e8f6198d15efeb83b7fdfb9d4d46f Mon Sep 17 00:00:00 2001 From: erdemcaygor Date: Tue, 2 Sep 2025 10:52:48 +0300 Subject: [PATCH] ssr removed from app template --- templates/app/angular/angular.json | 6 +- templates/app/angular/package.json | 6 +- .../app/angular/src/app/app.config.server.ts | 14 ---- .../app/angular/src/app/app.routes.server.ts | 24 ------- templates/app/angular/src/main.server.ts | 7 -- templates/app/angular/src/main.ts | 4 +- templates/app/angular/src/server.ts | 68 ------------------- templates/app/angular/tsconfig.server.json | 17 ----- 8 files changed, 4 insertions(+), 142 deletions(-) delete mode 100644 templates/app/angular/src/app/app.config.server.ts delete mode 100644 templates/app/angular/src/app/app.routes.server.ts delete mode 100644 templates/app/angular/src/main.server.ts delete mode 100644 templates/app/angular/src/server.ts delete mode 100644 templates/app/angular/tsconfig.server.json diff --git a/templates/app/angular/angular.json b/templates/app/angular/angular.json index 7c7f32c604..d2475f25ac 100644 --- a/templates/app/angular/angular.json +++ b/templates/app/angular/angular.json @@ -120,11 +120,7 @@ }, "src/styles.scss" ], - "scripts": [], - "outputMode": "server", - "ssr": { - "entry": "src/server.ts" - } + "scripts": [] }, "configurations": { "production": { diff --git a/templates/app/angular/package.json b/templates/app/angular/package.json index 28d866c48a..ee92d2df6f 100644 --- a/templates/app/angular/package.json +++ b/templates/app/angular/package.json @@ -8,8 +8,7 @@ "build:prod": "ng build --configuration production", "watch": "ng build --watch --configuration development", "test": "ng test", - "lint": "ng lint", - "serve:ssr:MyProjectName": "node dist/MyProjectName/browser/server/server.mjs" + "lint": "ng lint" }, "private": true, "dependencies": { @@ -34,7 +33,6 @@ "@angular/router": "~20.0.0", "@angular/ssr": "~20.0.0", "bootstrap-icons": "~1.8.0", - "express": "~5.1.0", "rxjs": "~7.8.0", "tslib": "^2.0.0", "zone.js": "~0.15.0" @@ -50,12 +48,10 @@ "@angular/cli": "~20.0.0", "@angular/compiler-cli": "~20.0.0", "@angular/language-service": "~20.0.0", - "@types/express": "~5.0.0", "@types/jasmine": "~3.6.0", "@types/node": "~20.11.0", "@typescript-eslint/eslint-plugin": "7.16.0", "@typescript-eslint/parser": "7.16.0", - "browser-sync": "^3.0.0", "eslint": "^8.0.0", "jasmine-core": "~4.0.0", "karma": "~6.3.0", diff --git a/templates/app/angular/src/app/app.config.server.ts b/templates/app/angular/src/app/app.config.server.ts deleted file mode 100644 index 3b6fd1ec1e..0000000000 --- a/templates/app/angular/src/app/app.config.server.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { mergeApplicationConfig, ApplicationConfig } from '@angular/core'; -import {provideServerRendering, withRoutes} from '@angular/ssr'; -import { appConfig } from './app.config'; -import {provideAbpOAuth} from "@abp/ng.oauth"; -import {serverRoutes} from "./app.routes.server"; - -const serverConfig: ApplicationConfig = { - providers: [ - provideAbpOAuth(), - provideServerRendering(withRoutes(serverRoutes)) - ] -}; - -export const config = mergeApplicationConfig(appConfig, serverConfig); diff --git a/templates/app/angular/src/app/app.routes.server.ts b/templates/app/angular/src/app/app.routes.server.ts deleted file mode 100644 index 0c0731eb1c..0000000000 --- a/templates/app/angular/src/app/app.routes.server.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {RenderMode, ServerRoute} from "@angular/ssr"; - -export const serverRoutes: ServerRoute[] = [ - { - path: '', - renderMode: RenderMode.Server - }, - { - path: 'account', - renderMode: RenderMode.Server - }, - { - path: 'identity', - renderMode: RenderMode.Server - }, - { - path: 'tenant-management', - renderMode: RenderMode.Server - }, - { - path: 'setting-management', - renderMode: RenderMode.Server - }, -]; diff --git a/templates/app/angular/src/main.server.ts b/templates/app/angular/src/main.server.ts deleted file mode 100644 index 8ec2a895c8..0000000000 --- a/templates/app/angular/src/main.server.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { bootstrapApplication } from '@angular/platform-browser'; -import { AppComponent } from './app/app.component'; -import {createAppConfig} from "./app/app.config"; - -const bootstrap = () => bootstrapApplication(AppComponent, createAppConfig(true)); - -export default bootstrap; diff --git a/templates/app/angular/src/main.ts b/templates/app/angular/src/main.ts index cb6d2ca149..ffaa39d183 100644 --- a/templates/app/angular/src/main.ts +++ b/templates/app/angular/src/main.ts @@ -1,5 +1,5 @@ import { bootstrapApplication } from '@angular/platform-browser'; -import {createAppConfig} from './app/app.config'; +import {appConfig} from './app/app.config'; import { AppComponent } from './app/app.component'; -bootstrapApplication(AppComponent, createAppConfig(false)).catch(err => console.error(err)); +bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); diff --git a/templates/app/angular/src/server.ts b/templates/app/angular/src/server.ts deleted file mode 100644 index e6546c414d..0000000000 --- a/templates/app/angular/src/server.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - AngularNodeAppEngine, - createNodeRequestHandler, - isMainModule, - writeResponseToNodeResponse, -} from '@angular/ssr/node'; -import express from 'express'; -import { join } from 'node:path'; - -const browserDistFolder = join(import.meta.dirname, '../browser'); - -const app = express(); -const angularApp = new AngularNodeAppEngine(); - -/** - * Example Express Rest API endpoints can be defined here. - * Uncomment and define endpoints as necessary. - * - * Example: - * ```ts - * app.get('/api/{*splat}', (req, res) => { - * // Handle API request - * }); - * ``` - */ - -/** - * Serve static files from /browser - */ -app.use( - express.static(browserDistFolder, { - maxAge: '1y', - index: false, - redirect: false, - }), -); - -/** - * Handle all other requests by rendering the Angular application. - */ -app.use((req, res, next) => { - angularApp - .handle(req) - .then((response) => - response ? writeResponseToNodeResponse(response, res) : next(), - ) - .catch(next); -}); - -/** - * Start the server if this module is the main entry point. - * The server listens on the port defined by the `PORT` environment variable, or defaults to 4000. - */ -if (isMainModule(import.meta.url)) { - const port = process.env['PORT'] || 4000; - app.listen(port, (error) => { - if (error) { - throw error; - } - - console.log(`Node Express server listening on http://localhost:${port}`); - }); -} - -/** - * Request handler used by the Angular CLI (for dev-server and during build) or Firebase Cloud Functions. - */ -export const reqHandler = createNodeRequestHandler(app); diff --git a/templates/app/angular/tsconfig.server.json b/templates/app/angular/tsconfig.server.json deleted file mode 100644 index 48bcde8ca3..0000000000 --- a/templates/app/angular/tsconfig.server.json +++ /dev/null @@ -1,17 +0,0 @@ -/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ -/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ -{ - "extends": "./tsconfig.app.json", - "compilerOptions": { - "outDir": "./out-tsc/server", - "types": [ - "node", - "@angular/localize" - ] - }, - "files": [ - "src/main.server.ts", - "src/server.ts", - "src/server.ts" - ] -}