移動文件

This commit is contained in:
CrescentLeaf
2025-07-16 22:52:58 +08:00
parent 930a9c6c07
commit 200a867171
27 changed files with 5 additions and 31 deletions

48
暫存/server/http.ts Normal file
View File

@@ -0,0 +1,48 @@
// deno-lint-ignore-file ban-types
import http from "node:http"
import https from "node:https"
// @ts-types="npm:@types/express"
import express from "express"
// @ts-types="npm:socket.io"
import { Server as SocketIoServer } from "socket.io"
interface TheWhiteSilkParams {
method: string
args: object
}
interface TheWhiteSilkCallback {
code: 200 | 400 | 401 | 403 | 404 | 500 | 501
msg: string
}
interface ClientToServerEvents {
the_white_silk: (arg: TheWhiteSilkParams, callback: (ret: TheWhiteSilkCallback) => void) => void
}
const useHttps = false
const app = express()
const httpApp = useHttps ? https.createServer(app) : http.createServer(app)
const sio = new SocketIoServer<
ClientToServerEvents,
{},
{},
{}
>(httpApp, {})
app.use("/", express.static("whitesilk_data/page_builded/"))
sio.on("connection", (socket) => {
socket.on("the_white_silk", (params, callback) => {
if ((params || callback) == null || typeof callback == "function") return
})
})
export {
app as expressApp,
httpApp as httpServer,
sio as SocketIoServer,
}