Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server + client): add support for server-sent events (SSE) #5713

Merged
merged 347 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from 205 commits
Commits
Show all changes
347 commits
Select commit Hold shift + click to select a range
038c1d6
wip
KATT May 10, 2024
55d03c1
cool
KATT May 10, 2024
1b552dc
cool
KATT May 10, 2024
847ed51
cool
KATT May 10, 2024
11009d0
cool
KATT May 10, 2024
9aabfcb
cool
KATT May 10, 2024
4b0bda5
cool
KATT May 10, 2024
82b4373
hmm
KATT May 10, 2024
b08d3d7
hmm
KATT May 10, 2024
1dddff0
wip
KATT May 10, 2024
c09d91f
wip
KATT May 10, 2024
3e99166
fix some tests
KATT May 10, 2024
59f6a43
cool
KATT May 10, 2024
093122c
cool
KATT May 10, 2024
cec0642
add subs to example
KATT May 10, 2024
7ee29f7
flush
KATT May 10, 2024
aa12806
wip
KATT May 10, 2024
b5b336c
sse
KATT May 10, 2024
201e7f5
cool
KATT May 10, 2024
65eaf3d
split in files
KATT May 10, 2024
87f26b9
wip
KATT May 10, 2024
8fd014c
split
KATT May 10, 2024
a00be23
wip
KATT May 10, 2024
fb3c01b
wip
KATT May 10, 2024
47242b3
cool
KATT May 11, 2024
474f6c6
all good
KATT May 11, 2024
919cef0
cool
KATT May 12, 2024
d2c7e99
cool
KATT May 12, 2024
2bb7406
cool
KATT May 12, 2024
19f2c95
cool
KATT May 12, 2024
a65036e
fix
KATT May 12, 2024
e53004a
SSEChunk
KATT May 12, 2024
7031fef
whatev
KATT May 12, 2024
064d020
clean
KATT May 12, 2024
21ffa6a
cool
KATT May 12, 2024
9ad2fa8
cool
KATT May 12, 2024
d75c6bb
snaps
KATT May 12, 2024
c546894
Merge branch '05-01-stream' into 05-10-subscriptions-sse
KATT May 12, 2024
faea513
Merge branch 'next' into 05-01-stream
KATT May 12, 2024
791f17e
Merge branch '05-01-stream' into 05-10-subscriptions-sse
KATT May 12, 2024
a037e5b
handle errors better
KATT May 12, 2024
03ab78f
events
KATT May 12, 2024
d7773bf
cool
KATT May 12, 2024
485f7d1
meep
KATT May 12, 2024
ded8075
cool
KATT May 12, 2024
032c2fb
wip
KATT May 12, 2024
7032ae4
wip
KATT May 12, 2024
6de7416
cool
KATT May 12, 2024
0925423
Revert "cool"
KATT May 12, 2024
497678e
cool
KATT May 12, 2024
5e67872
SSEvent
KATT May 12, 2024
3dd4993
cool
KATT May 12, 2024
c9d9729
ping optional
KATT May 12, 2024
cf302a8
cool
KATT May 12, 2024
ecea8e4
hi
KATT May 12, 2024
70a177d
cool
KATT May 12, 2024
54207d2
clear
KATT May 12, 2024
0840328
rename
KATT May 12, 2024
2d8cb98
cool
KATT May 12, 2024
2b0c452
maybe
KATT May 12, 2024
96bb932
pnpm
KATT May 12, 2024
d667f47
ok
KATT May 12, 2024
4563c9d
cool
KATT May 12, 2024
c9fb349
test
KATT May 12, 2024
e2ae805
maybe
KATT May 12, 2024
076f52d
no-transform
KATT May 13, 2024
a4d195b
tweak
KATT May 13, 2024
3b18e53
runtime
KATT May 13, 2024
33b5ec0
maybe
KATT May 13, 2024
03778e6
rev
KATT May 13, 2024
82aeb2e
Revert "rev"
KATT May 13, 2024
8b3d9a5
rev moar
KATT May 13, 2024
bf1a906
wip
KATT May 13, 2024
12e96f6
wip
KATT May 13, 2024
0a22c57
cool is typing bruv
KATT May 13, 2024
f65b3ad
updated at
KATT May 13, 2024
409ff4f
whoIs
KATT May 13, 2024
3a1cab6
Merge remote-tracking branch 'origin/next' into 05-01-stream
KATT May 13, 2024
4b0be07
Merge branch '05-01-stream' into 05-10-subscriptions-sse
KATT May 13, 2024
f25f919
demystify the code a bit
KATT May 13, 2024
efdec9e
cool
KATT May 13, 2024
ae74d3b
isTyping
KATT May 13, 2024
63108ec
lint fix
KATT May 13, 2024
be2f5c6
meep
KATT May 13, 2024
ff82e6b
cool
KATT May 13, 2024
c7ac555
update
KATT May 13, 2024
ae8f8e1
locky
KATT May 13, 2024
36e1049
cool
KATT May 13, 2024
64a7fdc
fixes
KATT May 13, 2024
be797d0
ffs
KATT May 13, 2024
1cf2733
fix more
KATT May 13, 2024
0140782
mmmm
KATT May 13, 2024
d914405
URL
KATT May 13, 2024
5c214a5
kewl
KATT May 13, 2024
8c74779
tweaks
KATT May 13, 2024
75801d4
Revert "maybe"
KATT May 15, 2024
af889a5
wip - reverting the edge stuff
KATT May 15, 2024
c5e462b
cool
KATT May 15, 2024
6ed3fee
cool
KATT May 15, 2024
8f65a84
cancel
KATT May 15, 2024
3177d84
some stuff
KATT May 16, 2024
d0d5821
upd
KATT May 16, 2024
f2f6394
somehow
KATT May 16, 2024
39c5188
cool
KATT May 16, 2024
422d3f4
chore: refactor `resolveResponse` (#5726)
KATT May 17, 2024
57586ec
Update examples/next-prisma-sse-subscriptions/prisma/schema.prisma
KATT May 17, 2024
5e76cf7
rm is typing
KATT May 17, 2024
6e501e3
cool
KATT May 17, 2024
b803d06
Update packages/client/src/links/internals/httpUtils.ts
KATT May 19, 2024
600f9de
Update packages/server/src/unstable-core-do-not-import/http/resolveRe…
KATT May 19, 2024
4a3e68b
Update packages/server/src/unstable-core-do-not-import/stream/stream.ts
KATT May 19, 2024
c2b5da3
Update packages/server/src/unstable-core-do-not-import/stream/stream.ts
KATT May 19, 2024
48d5a15
Merge branch '05-01-stream' into 05-10-subscriptions-sse
KATT May 19, 2024
0dc6072
fix
KATT May 19, 2024
02d36b6
chore: apply lint and formatting fixes
autofix-ci[bot] May 19, 2024
5535248
Merge branch 'next' into 05-01-stream
KATT May 19, 2024
830b73f
Merge branch '05-01-stream' into 05-10-subscriptions-sse
KATT May 19, 2024
36ba47d
Merge remote-tracking branch 'origin/next' into 05-10-subscriptions-sse
KATT May 19, 2024
e861e71
wip
KATT May 19, 2024
8788d1c
cool
KATT May 19, 2024
1315aed
tweak
KATT May 19, 2024
e950e4a
cool
KATT May 19, 2024
4e3db70
cool
KATT May 19, 2024
d7cc12a
cool
KATT May 19, 2024
b31553c
w/e
KATT May 19, 2024
fe2e3c6
serverless sse
KATT May 25, 2024
638d5f3
tweak
KATT May 25, 2024
41adef4
Merge branch 'next' into 05-10-subscriptions-sse
KATT May 25, 2024
5a6bb19
wip
KATT May 25, 2024
17ba242
Revert "rm is typing"
KATT May 25, 2024
ae695da
cool
KATT May 25, 2024
646abff
okay let’s see
KATT May 25, 2024
345005b
wip
KATT May 25, 2024
4ef7601
tweak
KATT May 25, 2024
b9545a2
huh wha
KATT May 25, 2024
864d395
deploy
KATT May 25, 2024
743bd03
cool
KATT May 25, 2024
8e1f437
maybe
KATT May 25, 2024
507c638
cool
KATT May 25, 2024
ded016c
no pooling for events
KATT May 25, 2024
c7d7bff
Merge remote-tracking branch 'origin/next' into 05-10-subscriptions-sse
KATT May 26, 2024
9ee2d0b
fix
KATT May 26, 2024
c2e3bef
cool
KATT May 26, 2024
2f27654
Merge remote-tracking branch 'origin/next' into 05-10-subscriptions-sse
KATT Jun 2, 2024
e51aa28
make it a rename plz
KATT Jun 7, 2024
def0aec
Merge remote-tracking branch 'origin/next' into 05-10-subscriptions-sse
KATT Jun 7, 2024
3d267ef
flip
KATT Jun 7, 2024
bb91d49
chore: apply lint and formatting fixes
autofix-ci[bot] Jun 7, 2024
9c444f6
bad
KATT Jun 7, 2024
252332f
Merge branch '05-10-subscriptions-sse' of github.com:trpc/trpc into 0…
KATT Jun 7, 2024
821d14f
fixenz
KATT Jun 7, 2024
fd9c8fa
fix test
KATT Jun 7, 2024
7c4be78
w/e
KATT Jun 7, 2024
9fe965a
mkay
KATT Jun 7, 2024
c3ab0ff
mkay
KATT Jun 8, 2024
b3c4abe
works
KATT Jun 8, 2024
e09e185
cool
KATT Jun 8, 2024
1fa972a
Merge branch 'next' into 05-10-subscriptions-sse
KATT Jun 8, 2024
718c616
cool
KATT Jun 8, 2024
7a8fc44
mkay
KATT Jun 8, 2024
87602ce
meow
KATT Jun 8, 2024
bd313c4
cool
KATT Jun 8, 2024
8fcc5af
ok docs
KATT Jun 8, 2024
717f376
oki
KATT Jun 8, 2024
716bb56
wa
KATT Jun 8, 2024
bbc3d4c
chore: apply lint and formatting fixes
autofix-ci[bot] Jun 8, 2024
7ccd544
clean
KATT Jun 8, 2024
5bab8cd
better
KATT Jun 8, 2024
3fcb543
mkay cool
KATT Jun 8, 2024
3f800aa
cool
KATT Jun 8, 2024
b8b914a
cool
KATT Jun 8, 2024
7d22b6e
Revert "chore: apply lint and formatting fixes"
KATT Jun 8, 2024
f166c08
meow
KATT Jun 8, 2024
472766d
changelog
KATT Jun 8, 2024
55ff89d
cool
KATT Jun 8, 2024
3330a9e
cool
KATT Jun 8, 2024
20f7169
cool
KATT Jun 8, 2024
963f32a
cool
KATT Jun 8, 2024
191418c
tweak
KATT Jun 8, 2024
384c5eb
tweaks
KATT Jun 8, 2024
be335d6
mayb
KATT Jun 8, 2024
500d155
Merge branch 'next' into 05-10-subscriptions-sse
KATT Jun 8, 2024
bc911c5
migrate
KATT Jun 8, 2024
bd59330
works maybe
KATT Jun 8, 2024
1009049
mayb
KATT Jun 8, 2024
4e77d6e
lockfile
KATT Jun 8, 2024
1f74285
nope
KATT Jun 8, 2024
6a5b7fb
nope
KATT Jun 8, 2024
3803ad0
wat
KATT Jun 8, 2024
0ae4d8d
whatev
KATT Jun 8, 2024
f87e93c
tweak
KATT Jun 8, 2024
e593dec
readd
KATT Jun 8, 2024
e8c316f
sort
KATT Jun 8, 2024
4f4a1e4
enable experimental functionality by default
KATT Jun 9, 2024
b5cbbad
some guards
KATT Jun 9, 2024
bded4a7
snap
KATT Jun 9, 2024
ff38537
mv
KATT Jun 9, 2024
e3a1caa
pnpm
KATT Jun 9, 2024
80870bc
Merge branch 'next' into 05-10-subscriptions-sse
kodiakhq[bot] Jun 9, 2024
34a558a
alt example
juliusmarminge Jun 9, 2024
639f05c
sync lock
juliusmarminge Jun 10, 2024
df4a36f
fix some stuff
juliusmarminge Jun 10, 2024
9d875d0
eh?
juliusmarminge Jun 10, 2024
d2c67e2
chore: apply lint and formatting fixes
autofix-ci[bot] Jun 10, 2024
36200bc
rename
juliusmarminge Jun 10, 2024
a846285
maybe fix examples
juliusmarminge Jun 10, 2024
1d69172
add table filter
juliusmarminge Jun 10, 2024
f7f877c
chore: apply lint and formatting fixes
autofix-ci[bot] Jun 10, 2024
62f858c
rm unused
juliusmarminge Jun 10, 2024
e79fe59
rm other
juliusmarminge Jun 10, 2024
62ebce2
fix
juliusmarminge Jun 10, 2024
0a8e32e
trust host
juliusmarminge Jun 10, 2024
270f1c3
rev
juliusmarminge Jun 10, 2024
54a414e
fix lightmode text
juliusmarminge Jun 10, 2024
0a92bca
chore: apply lint and formatting fixes
autofix-ci[bot] Jun 10, 2024
33b1434
fix some state
juliusmarminge Jun 10, 2024
1de886a
force lint-fix
juliusmarminge Jun 10, 2024
50e0d64
final fixes
juliusmarminge Jun 10, 2024
ee32a5a
chore: apply lint and formatting fixes
autofix-ci[bot] Jun 10, 2024
b343029
custom docker image
juliusmarminge Jun 10, 2024
364155b
fx path
juliusmarminge Jun 10, 2024
5cfce34
caps
juliusmarminge Jun 10, 2024
f5d4163
inject postgres url in build
juliusmarminge Jun 10, 2024
992a19a
hmm
juliusmarminge Jun 10, 2024
edb59c9
default
juliusmarminge Jun 10, 2024
a451cdd
eh?
juliusmarminge Jun 10, 2024
fc6dad0
fmm
juliusmarminge Jun 10, 2024
e754b2a
idk?
juliusmarminge Jun 10, 2024
6b60883
hmm
juliusmarminge Jun 10, 2024
daee869
re
juliusmarminge Jun 10, 2024
47d1b43
hmm
juliusmarminge Jun 10, 2024
9bc602c
expose 3000 ffs
juliusmarminge Jun 10, 2024
dd050f3
maybe v1 runtime???? this is insane
juliusmarminge Jun 10, 2024
4044d68
my bad...
juliusmarminge Jun 10, 2024
96d84d3
migrate during build
juliusmarminge Jun 10, 2024
f47d42c
Merge branch 'next' into 05-10-subscriptions-sse
kodiakhq[bot] Jun 12, 2024
b08d480
chore: apply lint and formatting fixes
autofix-ci[bot] Jun 12, 2024
b637a1f
Merge branch 'next' into 05-10-subscriptions-sse
juliusmarminge Jun 12, 2024
e760747
Revert "chore: apply lint and formatting fixes"
KATT Jun 20, 2024
0c7f0ff
Merge remote-tracking branch 'origin/next' into 05-10-subscriptions-s…
KATT Jun 20, 2024
404d537
keep dat ref
KATT Jun 20, 2024
e89a3ff
mkay
KATT Jun 20, 2024
0e3b46d
some tweaks
KATT Jun 20, 2024
dc7ca27
cool
KATT Jun 20, 2024
725ebaf
feat: add `sse()` (#5813)
KATT Jun 22, 2024
8b56ab0
skip
KATT Jun 22, 2024
aa57be8
mkay
KATT Jun 22, 2024
0c334d6
ohk
KATT Jun 22, 2024
0748a83
add test
KATT Jun 22, 2024
cf3a1cd
cool
KATT Jun 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
next-minimal-starter,
next-prisma-starter,
next-prisma-todomvc,
next-prisma-websockets-starter,
next-prisma-sse-subscriptions,
soa,
standalone-server,
vercel-edge-runtime,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/subtree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
path: [
#
next-prisma-starter,
next-prisma-websockets-starter,
next-prisma-sse-subscriptions,
next-prisma-todomvc,
next-minimal-starter,
next-big-router,
Expand Down
23 changes: 20 additions & 3 deletions examples/minimal/src/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/**
* This is the client-side code that uses the inferred types from the server
*/
import { createTRPCClient, httpBatchLink } from '@trpc/client';
import {
createTRPCClient,
splitLink,
unstable_httpBatchStreamLink,
unstable_httpSubscriptionLink,
} from '@trpc/client';
/**
* We only import the `AppRouter` type from the server - this is not available at runtime
*/
Expand All @@ -10,8 +15,14 @@ import type { AppRouter } from '../server/index.js';
// Initialize the tRPC client
const trpc = createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:3000',
splitLink({
condition: (op) => op.type === 'subscription',
true: unstable_httpSubscriptionLink({
url: 'http://localhost:3000',
}),
false: unstable_httpBatchStreamLink({
url: 'http://localhost:3000',
}),
}),
],
});
Expand All @@ -34,3 +45,9 @@ console.log('Created user:', createdUser);
const user = await trpc.user.byId.query('1');
// ^?
console.log('User 1:', user);

const iterable = await trpc.examples.iterable.query();

for await (const i of iterable) {
console.log('Iterable:', i);
}
9 changes: 9 additions & 0 deletions examples/minimal/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* This a minimal tRPC server
*/
import { createHTTPServer } from '@trpc/server/adapters/standalone';
import { observable } from '@trpc/server/observable';
import { z } from 'zod';
import { db } from './db.js';
import { publicProcedure, router } from './trpc.js';
Expand Down Expand Up @@ -32,6 +33,14 @@ const appRouter = router({
return user;
}),
},
examples: {
iterable: publicProcedure.query(async function* () {
for (let i = 0; i < 3; i++) {
await new Promise((resolve) => setTimeout(resolve, 500));
yield i;
}
}),
},
});

// Export type router type signature, this is used by the client.
Expand Down
6 changes: 5 additions & 1 deletion examples/minimal/src/server/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { initTRPC } from '@trpc/server';
* Initialization of tRPC backend
* Should be done only once per backend!
*/
const t = initTRPC.create();
const t = initTRPC.create({
experimental: {
iterablesAndDeferreds: true,
},
});

/**
* Export reusable router and procedure helpers
Expand Down
4 changes: 4 additions & 0 deletions examples/next-prisma-sse-subscriptions/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DATABASE_URL="postgresql://postgres:@localhost:5432/trpc-starter-websockets?schema=public"
APP_URL="http://localhost:3000"
NEXTAUTH_URL="http://localhost:3000/api/auth"
NEXTAUTH_SECRET="override-me"
3 changes: 3 additions & 0 deletions examples/next-prisma-sse-subscriptions/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Prisma + tRPC + WebSockets
# Prisma + tRPC + SSE

Try demo http://websockets.trpc.io/

## Features

- 🧙‍♂️ E2E type safety with [tRPC](https://trpc.io)
- ⚡ Full-stack React with Next.js
- ⚡ WebSockets / Subscription support
- ⚡ Server-sent-events / Subscription support
- ⚡ Database with Prisma
- 🔐 Authorization using [next-auth](https://next-auth.js.org/)
- ⚙️ VSCode extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const config = {
publicRuntimeConfig: {
// Will be available on both server and client
APP_URL: process.env.APP_URL,
WS_URL: process.env.WS_URL,
},
/** We run eslint as a separate task in CI */
eslint: { ignoreDuringBuilds: !!process.env.CI },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
{
"name": "examples-next-websockets-starter",
"name": "examples-next-sse",
"private": true,
"engines": {
"node": ">=18.15.0"
},
"scripts": {
"prebuild": "prisma generate && prisma migrate deploy",
"build:1-next": "cross-env NODE_ENV=production next build",
"build:2-server": "tsc --project tsconfig.server.json",
"build": "run-s build:*",
"dev:wss": "cross-env PORT=3001 tsx watch src/server/wssDevServer.ts --tsconfig tsconfig.server.json ",
"dev:next": "next dev",
"dev": "pnpm migrate-dev && run-p dev:*",
"build:1-prisma-generate": "prisma generate",
"build:2-prisma-migrate": "dotenv -c . prisma db push",
"build:3-next": "cross-env NODE_ENV=production next build",
"build": "dotenv -c . run-s build:*",
"dev": "next dev",
"db-up": "docker-compose up -d",
"db-seed": "prisma db seed",
"db-migrate-dev": "prisma migrate dev",
"dev-migrate": "dotenv -c . prisma migrate dev",
"db-nuke": "docker-compose down --volumes --remove-orphans",
"dx": "run-s db-up db-migrate-dev db-seed dev",
"dev-nuke": "rm -rf prisma/*.db**",
"dx": "run-s db-up dev-migrate db-seed dev",
"generate": "prisma generate",
"migrate-dev": "prisma migrate dev",
"migrate": "prisma migrate deploy",
"start": "cross-env NODE_ENV=production node dist/server/prodServer.js",
"start": "next start",
"studio": "prisma studio",
"lint": "eslint --cache --ext \".js,.ts,.tsx\" src",
"lint-fix": "pnpm lint --fix",
"test-dev": "cross-env APP_ENV=test start-server-and-test dev 3000 test",
"test-start": "cross-env APP_ENV=test WS_URL=ws://localhost:3000 start-server-and-test start 3000 test",
"test-start": "cross-env APP_ENV=test start-server-and-test start 3000 test",
"test": "playwright test",
"postinstall": "prisma generate"
},
Expand All @@ -52,23 +49,20 @@
"react-dom": "^18.3.1",
"superjson": "^1.12.4",
"tsx": "^4.0.0",
"ws": "^8.0.0",
"zod": "^3.0.0"
},
"devDependencies": {
"@playwright/test": "^1.26.1",
"@tanstack/react-query-devtools": "^5.0.0",
"@types/node": "^20.10.0",
"@types/react": "^18.3.1",
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"autoprefixer": "^10.4.7",
"cross-env": "^7.0.3",
"dotenv-cli": "^7.3.0",
"eslint": "^8.56.0",
"eslint-config-next": "^14.0.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.14",
"prettier": "^2.8.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

datasource db {
provider = "postgres"
url = env("DATABASE_URL")
// provider = "sqlite"
// url = "file:./dev.db"
}
Expand All @@ -28,3 +27,4 @@ model Post {
createdAt DateTime @unique @default(now())
updatedAt DateTime @unique @default(now())
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '../styles/global.css';
import type { Session } from 'next-auth';
import { getSession, SessionProvider } from 'next-auth/react';
import type { AppType } from 'next/app';
import { trpc } from 'utils/trpc';
import { trpc } from '~/utils/trpc';

const MyApp: AppType<{ session: Session | null }> = ({
Component,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from 'next/link';
import { useState } from 'react';
import { trpc } from 'utils/trpc';
import { trpc } from '~/utils/trpc';

export default function AboutPage() {
const [num, setNumber] = useState<number>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import NextAuth from 'next-auth';
import { authOptions } from '~/server/authOptions';

export default NextAuth(authOptions);
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
* This file contains the tRPC http response handler and context creation for Next.js
*/
import * as trpcNext from '@trpc/server/adapters/next';
import { createContext } from 'server/context';
import type { AppRouter } from 'server/routers/_app';
import { appRouter } from 'server/routers/_app';

import { createContext } from '~/server/context';
import type { AppRouter } from '~/server/routers/_app';
import { appRouter } from '~/server/routers/_app';

export default trpcNext.createNextApiHandler<AppRouter>({
router: appRouter,
Expand Down