server.js 393 Bytes
Newer Older
Lee SeoYeon's avatar
commit    
Lee SeoYeon committed
1
import express from 'express'
Lee SeoYeon's avatar
0111    
Lee SeoYeon committed
2
3
4
5
6
import connectDb from "./utils/connectDb.js"
import userRouter from "./routes/user.routes.js"
import authRouter from "./routes/auth.routes.js"

connectDb()
Lee SeoYeon's avatar
commit    
Lee SeoYeon committed
7
8
9

const app = express()

Lee SeoYeon's avatar
0111    
Lee SeoYeon committed
10
app.use('/images', express.static('uploads/'))
Lee SeoYeon's avatar
commit    
Lee SeoYeon committed
11

Lee SeoYeon's avatar
0111    
Lee SeoYeon committed
12
app.use(express.json())
Lee SeoYeon's avatar
commit    
Lee SeoYeon committed
13

Lee SeoYeon's avatar
0111    
Lee SeoYeon committed
14
15
app.use(userRouter)
app.use(authRouter)
Lee SeoYeon's avatar
commit    
Lee SeoYeon committed
16

Lee SeoYeon's avatar
0111    
Lee SeoYeon committed
17
18
app.listen(3001, () => {
    console.log('Listening on port 3001')
Lee SeoYeon's avatar
commit    
Lee SeoYeon committed
19
})