File tree Expand file tree Collapse file tree 4 files changed +15
-7
lines changed
Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 33 "workspaces" : {
44 "" : {
55 "name" : " course-mate" ,
6+ "dependencies" : {
7+ "@hono/node-server" : " ^1.13.8" ,
8+ },
69 "devDependencies" : {
710 "@biomejs/biome" : " ^1.9.1" ,
811 "lefthook" : " ^1.10.10" ,
278281
279282 "@grpc/proto-loader" : [
" @grpc/[email protected] " ,
" " , {
"dependencies" : {
"lodash.camelcase" :
" ^4.3.0" ,
"long" :
" ^5.0.0" ,
"protobufjs" :
" ^7.2.5" ,
"yargs" :
" ^17.7.2" },
"bin" : {
"proto-loader-gen-types" :
" build/bin/proto-loader-gen-types.js" } },
" sha512-AiXO/bfe9bmxBjxxtYxFAXGZvMaN5s8kO+jBHAJCON8rJoB5YS/D6X7ZNc6XQkuHNmyl4CYaMI1fJ/Gn27RGGw==" ],
280283
284+ "@hono/node-server" : [
" @hono/[email protected] " ,
" " , {
"peerDependencies" : {
"hono" :
" ^4" } },
" sha512-fsn8ucecsAXUoVxrUil0m13kOEq4mkX4/4QozCqmY+HpGfKl74OYSn8JcMA8GnG0ClfdRI4/ZSeG7zhFaVg+wg==" ],
285+
281286 "@hono/zod-validator" : [
" @hono/[email protected] " ,
" " , {
"peerDependencies" : {
"hono" :
" >=3.9.0" ,
"zod" :
" ^3.19.1" } },
" sha512-xIgMYXDyJ4Hj6ekm9T9Y27s080Nl9NXHcJkOvkXPhubOLj8hZkOL8pDnnXfvCf5xEE8Q4oMFenQUZZREUY2gqQ==" ],
282287
283288 "@hookform/resolvers" : [
" @hookform/[email protected] " ,
" " , {
"peerDependencies" : {
"react-hook-form" :
" ^7.0.0" } },
" sha512-79Dv+3mDF7i+2ajj7SkypSKHhl1cbln1OGavqrsF7p6mbUv11xpqpacPsGDCTRvCSjEEIez2ef1NveSVL3b0Ag==" ],
Original file line number Diff line number Diff line change 3636 "lefthook" : " ^1.10.10" ,
3737 "lint-staged" : " ^15.2.10"
3838 },
39- "dependencies" : {},
39+ "dependencies" : {
40+ "@hono/node-server" : " ^1.13.8"
41+ },
4042 "trustedDependencies" : [" @biomejs/biome" , " lefthook" ]
4143}
Original file line number Diff line number Diff line change 1- import type { Server } from "node:http" ;
21import { Hono } from "hono" ;
32import { cors } from "hono/cors" ;
43import { HTTPException } from "hono/http-exception" ;
@@ -58,7 +57,6 @@ export function main() {
5857 port : process . env . PORT ?? 3000 ,
5958 } ) ;
6059 // ??
61- initializeSocket ( server as unknown as Server , corsOptions ) ;
62- return server ;
60+ return initializeSocket ( app , corsOptions ) ;
6361}
6462export default app ;
Original file line number Diff line number Diff line change 1- import type { Server } from "node:http " ;
1+ import { serve } from "@hono/ node-server " ;
22import type { Message , UserID } from "common/types" ;
3- import type { CorsOptions } from "cors " ;
3+ import type { Hono } from "hono " ;
44import { type Socket , Server as SocketIOServer } from "socket.io" ;
55import { getUserIdFromToken } from "../../firebase/auth/db" ;
66
77const users = new Map < UserID , Socket > ( ) ;
88
99export function initializeSocket (
10- server : Server ,
10+ app : Hono ,
1111 corsOptions : {
1212 origin : string [ ] ;
1313 } ,
1414) {
15+ const server = serve ( app ) ;
1516 const cors = {
1617 ...corsOptions ,
1718 origin : corsOptions . origin [ 0 ] ,
@@ -46,6 +47,8 @@ export function initializeSocket(
4647 }
4748 } ) ;
4849 } ) ;
50+
51+ return server ;
4952}
5053
5154export function sendMessage ( message : Message , friendId : UserID ) {
You can’t perform that action at this time.
0 commit comments