-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (41 loc) · 1.3 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
const express = require("express");
const { fileRouter } = require("./routes/file");
const cors = require("cors");
require("dotenv").config();
const app = express();
app.use(express.json());
app.use(cors());
app.get("/home", (req, res) => {
res.send(
`<h1>Congratulations! 🎉</h1><p>You've entered file storage application. Enjoy your experience!</p>`
);
});
// // Route to retrieve information about files from RDS
// app.get("/files", async (req, res) => {
// try {
// // Query file information from RDS
// const sql = "SELECT * FROM files";
// db.query(sql, (err, result) => {
// if (err) {
// console.error(err);
// res.status(500).json({ message: "Internal Server Error." });
// return;
// }
// // Extract relevant information for the response
// const fileData = result.map((file) => ({
// filename: file.filename,
// fileUrl: file.file_url,
// // lastModified: file.last_modified,
// // size: file.size / 1024 + "KB", // Adjust this based on your RDS schema
// }));
// res.status(200).json(fileData);
// });
// } catch (error) {
// console.error(error);
// res.status(500).json({ message: "Internal Server Error." });
// }
// });
app.use("/file", fileRouter);
module.exports = {
app
};