Skip to content

Commit

Permalink
i think ill use multer for project file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Ianyourgod committed Apr 5, 2024
1 parent ae7b64e commit ad63cb2
Show file tree
Hide file tree
Showing 4 changed files with 261 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/db/UserManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ class UserManager {
});
}

/**
* Reset a minio bucket
* @param {string} bucketName - Name of the bucket
* @async
*/
async resetBucket(bucketName) {
const objectsStream = this.minioClient.listObjects(bucketName);

Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ const um = require('./api/db/UserManager');
const cast = require("./utils/Cast");
const path = require('path');
const functions = require('./utils/functions');
const multer = require('multer');

const app = express();
const PORT = process.env.PORT || 3000;
const MAXVIEWS = process.env.MAXVIEWS || 10000; // it will take up to 10000 views then reset after
const VIEWRESETRATE = process.env.VIEWRESETRATE || 1000 * 60 * 60; // reset every hour
const upload = multer({ dest: 'uploads/' });

app.use(cors({
origin: '*',
Expand Down Expand Up @@ -46,7 +48,7 @@ const Cast = new cast();
const UserManager = new um();

(async () => {
await UserManager.init();
await UserManager.init(MAXVIEWS, VIEWRESETRATE);

app.get("/test", (req, res) => {
res.sendFile(path.join(__dirname, 'test.html'));
Expand Down
Loading

0 comments on commit ad63cb2

Please sign in to comment.