index.js
754 Bytes
const express = require('express')
const app = express()
const route = require('./router.js')
const bodyParser = require('body-parser')
const expressSession = require('express-session');
const passport = require('./passport.js')
const flash = require('connect-flash')
const path=require('path')
app.set('views', __dirname + '/public')
app.set('view engine', 'ejs')
app.use(express.static(__dirname+'/public'))
app.use(bodyParser.urlencoded({extended:false}))
app.use(bodyParser.json())
app.use(passport.initialize())
app.use(passport.session())
app.use(flash())
app.use(expressSession({
secret: 'my Key',
resave: true,
saveUninitialized:true
}))
app.use('/', route)
app.listen(3000, () => {
console.log("3000 port is on!")
})