Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

app.config.server.ts

21 lines755 Bytes

1import type { BootstrapContext } from '@angular/platform-browser'
2import { mergeApplicationConfig } from '@angular/core'
3import { provideServerRendering, withRoutes } from '@angular/ssr'
4import { QueryClient } from '@tanstack/angular-query-experimental'
5import { getBaseAppConfig, sharedQueryDefaults } from './app.config'
6import { serverRoutes } from './app.routes.server'
7​
8const createServerQueryClient = () =>
9 new QueryClient({
10 defaultOptions: {
11 queries: {
12 ...sharedQueryDefaults,
13 retry: false,
14 },
15 },
16 })
17​
18export const getServerConfig = (_context: BootstrapContext) =>
19 mergeApplicationConfig(getBaseAppConfig(createServerQueryClient()), {
20 providers: [provideServerRendering(withRoutes(serverRoutes))],
21 })