-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSuPawMarket.js
37 lines (32 loc) · 1.12 KB
/
SuPawMarket.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const express = require("express");
const path = require("path");
const app = express();
const port = 3000;
var connection = require('./database').databaseConnection;
var bodyParser = require('body-parser');
var jsonParser = bodyParser.json();
var urlencodedParser = bodyParser.urlencoded({ extended: false });
// Set the view engine to ejs if you are rendering views
app.set("view engine", "ejs");
// Added views and public folder
app.use(express.static(path.join(__dirname, "views")));
app.use(express.static(path.join(__dirname, "public")));
app.use(express.static(path.join(__dirname, "product-images")));
// Require the module you just created
const myApi = require("./routes/myApi");
const session = require("express-session");
//Initialize a session object
app.use(session({
secret:'secretKey',
resave: false,
saveUninitialized: false
}));
// Use the module with your Express application at the root path
app.use("/", myApi); // Mount at the root path
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});