I'm trying to deploy my app on vercel using node adapter. I know that i should use the vercel adapter but i made some changes to make sveltekit work with socket.io. I followed this guide: https://joyofcode.xyz/using-websockets-with-sveltekit.
The Node adapter creates the index.js and handler.js files in your build folder when you run npm run build — creating a custom server works by importing the handler from build/handler.js and using your custom server instead of index.js. Then I created a index.js file at the root of the project with the following content:
import http from 'http';
import express from 'express';
import injectSocketIO from './src/lib/websockets/socketIoHandler.js';
import { handler } from './build/handler.js'
const app = express();
const server = http.createServer(app);
// // Inject SocketIO
injectSocketIO(server);
// // SvelteKit handlers
app.use(handler);
server.listen(3000, () =\> {
console.log('Running on http://localhost:3000');
});
i tryied in some ways to make the deploy but I can't make it work...
How could I deploy the app on vercel? Thanks!
enter image description here using this vercel.json file:
{
"version": 2,
"builds": [
{
"src": "./index.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/web/(.*)",
"dest": "/"
}
]
}