Commit 09af2954 authored by Soo Hyun Kim's avatar Soo Hyun Kim
Browse files

Merge remote-tracking branch 'origin/young' into soo-12-28

parents b7b9b6c2 c4848cf1
import express from 'express'
import connectDb from './utils/connectDb.js'
import userRouter from './routes/user.routers.js'
import userRouter from './routes/user.routes.js'
connectDb()
const app = express()
app.use(express.json())
//이부분을 body 파싱함
//express가 req.body라는곳을 자동으로만들어서 json형식으로 보낸것을 객체형식으로 넣음
//이부분 다음부터는 req.body라는 부분을 실행할 수 있음
app.use(userRouter)
//userRouter로 이동
app.get('/', (req, res) => {
res.sendFile('../client/src/index.js')
res.send('Hello World. 안녕하세요')
})
app.listen(3001, () => {
console.log('Listening on port 3001')
app.listen(3030, () => {
console.log('Listening on port 3030')
})
......@@ -4,11 +4,11 @@ import config from '../config.js'
const connection = {}
async function connectDb() {
if (connection.isConnected){
if (connection.isConnected) {
return
}
const db = await mongoose.connect(config.mongoDbUri,{
const db = await mongoose.connect(config.mongoDbUri, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment