Skip to content

Commit

Permalink
fix: add commented out example API to code snippets shown on incompat…
Browse files Browse the repository at this point in the history
…ible server.ts error
  • Loading branch information
pieh committed Nov 21, 2024
1 parent 1cdeac4 commit ef7cc82
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/helpers/serverModuleHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ import { render } from '@netlify/angular-runtime/common-engine'
const commonEngine = new CommonEngine()
export async function netlifyCommonEngineHandler(request: Request, context: any): Promise<Response> {
// Example API endpoints can be defined here.
// Uncomment and define endpoints as necessary.
// const pathname = new URL(request.url).pathname;
// if (pathname === '/api/hello') {
// return Response.json({ message: 'Hello from the API' });
// }
return await render(commonEngine)
}
`
Expand All @@ -29,6 +36,13 @@ const angularAppEngine = new AngularAppEngine()
export async function netlifyAppEngineHandler(request: Request): Promise<Response> {
const context = getContext()
// Example API endpoints can be defined here.
// Uncomment and define endpoints as necessary.
// const pathname = new URL(request.url).pathname;
// if (pathname === '/api/hello') {
// return Response.json({ message: 'Hello from the API' });
// }
const result = await angularAppEngine.handle(request, context)
return result || new Response('Not found', { status: 404 })
}
Expand Down

0 comments on commit ef7cc82

Please sign in to comment.