import express from 'express'
import cookieParser from 'cookie-parser'
import * as bodyParser from 'body-parser'
import indexRouter from './router'
import * as dotenv from 'dotenv'
import logger from 'morgan'
import cors from 'cors'
dotenv.config({ path: __dirname+'/.env' }   )
const app = express();
const port = process.env.PORT || 3000;

app.use(express.json())
app.use(cookieParser())
app.use(cors())

app.use(logger('dev'))
app.use('/api', indexRouter)

app.listen(port, () => {
    console.log(`Server listening on the port  ${port}`);
})
