MCPcopy Create free account
hub / github.com/TanStack/router / createSpaServer

Function createSpaServer

e2e/solid-start/basic/server.js:52–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50}
51
52export async function createSpaServer() {
53 const app = express()
54
55 app.use(
56 '/api',
57 createProxyMiddleware({
58 target: `http://localhost:${startPort}/api`, // Replace with your target server's URL
59 changeOrigin: false, // Needed for virtual hosted sites,
60 }),
61 )
62
63 app.use(
64 '/_serverFn',
65 createProxyMiddleware({
66 target: `http://localhost:${startPort}/_serverFn`, // Replace with your target server's URL
67 changeOrigin: false, // Needed for virtual hosted sites,
68 }),
69 )
70
71 app.use(express.static(distClientDir))
72
73 app.get('/{*splat}', (req, res) => {
74 res.sendFile(path.resolve(distClientDir, 'index.html'))
75 })
76
77 return { app }
78}
79
80if (isSpaMode) {
81 createSpaServer().then(async ({ app }) =>

Callers 1

server.jsFile · 0.70

Calls 2

resolveMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected