mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: connect to localhost
This commit is contained in:
1 parent
577352e51d
commit
a74233d7f9
6 files changed
+82
-121
No files matched your search
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "^11.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"dockerode": "^3.3.5",
|
||||
"express": "^4.18.2",
|
||||
"jsonwebtoken": "^9.0.1",
|
||||
|
||||
@@ -4,7 +4,11 @@ import Session from '../models/session.js'
|
||||
import { defaultUser, genSessionJWT } from '../utils/auth.js'
|
||||
|
||||
export default (server) => {
|
||||
const io = new Server(server)
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
origin: '*',
|
||||
},
|
||||
})
|
||||
|
||||
io.use(async (socket, next) => {
|
||||
console.log('Authenticating...')
|
||||
|
||||
@@ -3,6 +3,7 @@ import express from 'express'
|
||||
import http from 'http'
|
||||
import YAML from 'yaml'
|
||||
import swaggerUI from 'swagger-ui-express'
|
||||
import cors from 'cors'
|
||||
|
||||
import socketServer from './api/socket.js'
|
||||
import connectDB from './db.js'
|
||||
@@ -22,6 +23,11 @@ async function main() {
|
||||
const swaggerDocument = YAML.parse(file)
|
||||
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocument))
|
||||
app.use(express.json())
|
||||
app.use(
|
||||
cors({
|
||||
origin: '*',
|
||||
})
|
||||
)
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World!')
|
||||
|
||||
Reference in new issue
Block a user