-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (54 loc) · 1.53 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var mysql = require("mysql");
const express = require("express");
const app = express();
var path = require("path");
const fs = require("fs");
var session = require("express-session");
app.engine("html", require("ejs").renderFile);
app.set("view engine", "html");
const bodyParser = require("body-parser");
var nodemailer = require("nodemailer");
app.use(express.urlencoded({ extended: false }));
app.use(express.static("."));
app.use(express.static(path.join(__dirname, "views")));
var PORT = process.env.PORT || 8000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}.`);
});
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "unipa",
});
con.connect(function (err) {
if (err) throw err;
console.log("Connesso");
con.query("CREATE DATABASE IF NOT EXISTS gestioneAffitti", function (
err,
result
) {
if (err) throw err;
console.log("Database GESTIONE AFFITTI creato");
});
});
const tables = require("./tables");
tables.crea_tableUtenteCliente();
tables.crea_tableUtenteProprietario();
tables.crea_tableCasa();
tables.crea_tablePrenotazione();
tables.crea_tableData();
tables.crea_tableRencensione();
tables.crea_tableFoto();
app.use(
session({
secret: "El segreto",
resave: false,
saveUninitialized: true,
cookie: { maxAge: 60000 },
})
);
const action = require("./action")(app);
const action2 = require("./action2")(app);
const action3 = require("./action3")(app);
const action4 = require("./action4")(app);
const action5 = require("./action5")(app);