Skip to content

Commit

Permalink
Merge pull request #20 from Crazy-Cow/CD-58
Browse files Browse the repository at this point in the history
feat:  app_cannon file 모듈화 [CD-58]
  • Loading branch information
ddubbu-dev authored Nov 15, 2024
2 parents a7f92f9 + 76ba3e6 commit 8dcca4e
Show file tree
Hide file tree
Showing 11 changed files with 472 additions and 313 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"plugins": ["@typescript-eslint", "prettier", "import"],
"rules": {
"prettier/prettier": ["error"],
"prettier/prettier": ["error", { "endOfLine": "auto" }],
"no-param-reassign": ["error", { "props": false }],
"@typescript-eslint/lines-between-class-members": ["off"],
},
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"endOfLine": "lf"
"endOfLine": "auto"
}
2 changes: 1 addition & 1 deletion pm2.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-project",
"script": "./build/app_cannon.js",
"script": "./build/app.js",
"cwd": ".",
"watch": true,
"ignore_watch": ["node_modules", "logs"],
Expand Down
38 changes: 24 additions & 14 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import cors from 'cors'
import express, { Express } from 'express'
import cookieParser from 'cookie-parser'
import routes from './routes'
import { connectDB } from './schemas'
// import { connectDB } from './schemas'
import swaggerUi from 'swagger-ui-express'
import swaggerDocument from './docs/swagger-output.json'
import { initSocket } from './socket'
import { Server, ServerOptions } from 'socket.io'
import { initInGmaeSocket } from './game/server'

const port = process.env.PORT
const socketClientUrl = process.env.SOCKET_CLIENT_URL
Expand All @@ -30,17 +31,26 @@ app.use('/example', routes.example)
app.use('/user', routes.user)
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument))

connectDB()
.then(() => console.log('[1] DB Connected'))
.then(() => {
console.log('[1] (mongoDB) DB Connected')
const server = app.listen(port, () => {
console.log(`[2] Server runs at <http://localhost>:${port}`)
})
const server = app.listen(port, () => {
console.log(`[2] Server runs at <http://localhost>:${port}`)
})

const io = new Server(server, socketCorsOption)
initSocket(io)
})
.catch((err) => {
console.error('[Error] DB Connection Failed:', err)
})
const io = new Server(server, socketCorsOption)
initSocket(io)
initInGmaeSocket(io)

// connectDB()
// .then(() => console.log('[1] DB Connected'))
// .then(() => {
// console.log('[1] (mongoDB) DB Connected')
// const server = app.listen(port, () => {
// console.log(`[2] Server runs at <http://localhost>:${port}`)
// })

// const io = new Server(server, socketCorsOption)
// initSocket(io)
// initInGmaeSocket(io)
// })
// .catch((err) => {
// console.error('[Error] DB Connection Failed:', err)
// })
296 changes: 0 additions & 296 deletions src/app_cannon.ts

This file was deleted.

Loading

0 comments on commit 8dcca4e

Please sign in to comment.