feat(@angular/build): utilize ssr.entry in Vite dev-server when available#28463
Merged
alan-agius4 merged 4 commits intoangular:mainfrom Sep 23, 2024
Merged
Conversation
This was
linked to
issues
Sep 20, 2024
Closed
765134d to
c0315fb
Compare
5024073 to
8b3bad2
Compare
6aa75e1 to
09224fa
Compare
… URL parameter Modified the `HtmlTransformHandler` type to accept a context object containing a URL and HTML content. This change supports the `html:transform:pre` hook, enhancing the handler's capability to process transformations based on the request URL.
1dd5a11 to
be51ae1
Compare
cb30910 to
aad619f
Compare
aad619f to
3ed259c
Compare
3ed259c to
22d7c3c
Compare
Closed
1 task
036f598 to
07311d7
Compare
9030fa2 to
af442de
Compare
…ilable When `ssr.entry` (server.ts) is defined, Vite will now use it in the dev-server. This allows API and routes defined in `server.ts` to be accessible during development. This feature requires the new `@angular/ssr` APIs, which are currently in developer preview.
…Handler `utilities
Introduced the `createRequestHandler` and `createNodeRequestHandler` utilities to expose middleware functions from the `server.ts` entry point for use with Vite.
This provides flexibility in integrating different server frameworks, including Express, Hono, and Fastify, with Angular SSR.
Examples:
**Express**
```ts
export default createNodeRequestHandler(app);
```
**Nest.js**
```ts
const app = await NestFactory.create(AppModule);
export default createNodeRequestHandler(app);
```
**Hono**
```ts
const app = new Hono();
export default createRequestHandler(app.fetch);
```
**Fastify**
```ts
export default createNodeRequestHandler(async (req, res) => {
await app.ready();
app.server.emit('request', req, res);
});
```
Improve code structure
af442de to
84936cf
Compare
clydin
approved these changes
Sep 23, 2024
Member
clydin
left a comment
There was a problem hiding this comment.
We should consider consolidating some of the E2E test logic here at some point.
Otherwise, LGTM.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(@angular/build): utilize
ssr.entryin Vite dev-server when availableWhen
ssr.entry(server.ts) is defined, Vite will now use it in the dev-server. This allows API and routes defined inserver.tsto be accessible during development. This feature requires the new@angular/ssrAPIs, which are currently in developer preview.feat(@angular/ssr): add
createRequestHandlerandcreateNodeRequestHandlerutilitiesIntroduced the
createRequestHandlerandcreateNodeRequestHandlerutilities to expose middleware functions from theserver.tsentry point for use with Vite.This provides flexibility in integrating different server frameworks, including Express, Hono, and Fastify, with Angular SSR.
Examples:
Express
Nest.js
Hono
Fastify