app.js 918 Bytes
var express = require('express')
var bodyParser = require('body-parser')
var app = express()
var router = require('./router/index')

//패스포트 관련 모듈들
var passport = require('passport')
var LocalStrategy = require('passport-local').Strategy;
var session = require('express-session')
var flash = require('connect-flash')




app.listen(3000, function () {
    console.log('start! express server')

})

//static으로 요청했을때 바로 받아볼수있다.
app.use(express.static('public'))
app.use(express.static('views'))


//express 서버에 body Parser 쓰다고 알려야함.
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: true}))

//view 엔진 사용
app.set('view engine', 'ejs')


app.use(session({
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: true
}))
app.use(passport.initialize())
app.use(passport.session())
app.use(flash())

app.use(router)