BLUE
PHP 7.4.33
Path:
/var/www/idmc.bitkit.dk/httpdocs
Run
Logout
Edit File
Size: 1.88 KB
Close
/var/www/idmc.bitkit.dk/httpdocs/app.js
Text
Base64
const express = require("express"); const bodyParser = require("body-parser"); const app = express(); const pool = require("./db"); // Import the pool instead of a single connection const session = require("express-session"); const MySQLStore = require("express-mysql-session")(session); const { sessionSecretKey } = require("./constants"); const mmRouters = require("./routes/marketing-manager"); const adminRouters = require("./routes/admin"); const dmcRouters = require("./routes/dmc"); const sdRouters = require("./routes/sales-director"); const publicRouters = require("./routes/public-routes"); // Test database connection pool.getConnection((err, connection) => { if (err) { console.error('Database connection failed:', err); process.exit(1); } else { console.log('Database connected successfully.'); connection.release(); // Release the connection back to the pool } }); // Configure session store using express-mysql-session const sessionStore = new MySQLStore( { expiration: 1000 * 60 * 60 * 24, // Session expiration time (milliseconds) createDatabaseTable: true, schema: { tableName: "sessions", columnNames: { session_id: "session_id", expires: "expires", data: "data", }, }, }, pool // Pass the pool to the session store ); app.use( session({ key: "IDMC", secret: sessionSecretKey, store: sessionStore, resave: false, saveUninitialized: false, }) ); app.set("view engine", "ejs"); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.use(express.static("public")); app.use(publicRouters); app.use(mmRouters); app.use(adminRouters); app.use(dmcRouters); app.use(sdRouters); // 404 Handler app.use((req, res) => { res.status(404).render("404", { message: "" }); }); // Start server app.listen(3013, () => { console.log('Server is running on port 3013'); });
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 7 × Files: 12
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.git
DIR
-
drwx------
2024-09-10 05:18:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
controller
DIR
-
drwx------
2024-10-17 05:06:23
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
node_modules
DIR
-
drwxrwxr-x
2024-09-23 09:37:26
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
public
DIR
-
drwx------
2024-09-12 05:37:32
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
routes
DIR
-
drwx------
2024-09-10 04:32:24
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
uploads
DIR
-
drwx------
2024-09-10 04:32:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
views
DIR
-
drwx------
2024-09-10 04:32:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
.DS_Store
8.00 KB
lrw-------
2024-09-10 04:32:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
.gitignore
32 B
lrw-------
2024-09-10 04:32:04
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
1
463 B
lrw-r--r--
2024-09-23 12:15:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
app.js
1.88 KB
lrw-r--r--
2024-09-23 09:39:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
constants.js
1.26 KB
lrw-------
2024-09-10 04:32:02
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
db.js
463 B
lrw-------
2024-09-23 12:16:02
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
dbStructure.xlsx
21.37 KB
lrw-------
2024-09-10 04:32:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
googleDriveAPIkey.json
2.30 KB
lrw-------
2024-09-10 04:32:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
IDMC.sql
26.16 KB
lrw-------
2024-09-10 05:27:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
package-lock.json
89.15 KB
lrw-rw-r--
2024-09-23 09:37:26
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
package.json
761 B
lrw-------
2024-09-10 11:07:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
temp
976 B
lrw-------
2024-09-10 04:32:02
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).