Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require("path");
- const express = require("express");
- const bodyParser = require("body-parser");
- const session = require("express-session");
- const flash = require("express-flash");
- require("dotenv").config();
- const cors = require("cors");
- const sequelize = require("./util/db");
- const indexRoute = require("./routes/index");
- const errorController = require("./controllers/error");
- const app = express();
- app.set("view engine", "pug");
- app.use(
- session({
- cookie: { maxAge: 60000 },
- secret: process.env.SESSION_SECRET,
- resave: true,
- saveUninitialized: false,
- })
- );
- app.use(cors());
- app.use(flash());
- app.use(express.static(path.join(__dirname, "/public")));
- app.use(bodyParser.json());
- app.use(bodyParser.urlencoded({ extended: true }));
- app.use(indexRoute);
- app.use(errorController.get404);
- (async () => {
- await sequelize.sync();
- app.listen(3000, () => {
- console.log("App is running at http://localhost:3000");
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement