const express = require("express") const mongoose = require("mongoose") const config = require("config") const authRouter = require("./router/authorization") const projectRouter = require("./router/ProjectRouter") const corsMiddleware = require("./middleware/cors") const PORT = config.get('serverPort') const app = express() app.use(corsMiddleware) app.use(express.json()) app.use('/api/authorization',authRouter) app.use('/api/project',projectRouter) const start = async() =>{ try{ await mongoose.connect(config.get("mongodb"),{ useNewUrlParser:true, useUnifiedTopology:true }) app.listen(PORT,()=>{console.log("server listen:",PORT)}) }catch(e){ console.log("error:",e) } } start()