Skip to content
Snippets Groups Projects
index.ts 351 B
Newer Older
  • Learn to ignore specific revisions
  • ='s avatar
    = committed
    import express, { Express } from "express";
    import router from "./routes/index" 
    
    Iheb Boussida's avatar
    Iheb Boussida committed
    import { allowCors } from "./middleware/CORS/allowCors";
    
    ='s avatar
    = committed
    
    const port = 8000;
    const app: Express = express();
    app.use(express.json());
    
    Iheb Boussida's avatar
    Iheb Boussida committed
    app.use (allowCors) ;
    
    ='s avatar
    = committed
    app.use ("/api",router);  
    
    
    app.listen(port, () => {
      console.log(`Example app listening on port ${port}`);
    });