Skip to content

Commit

Permalink
configured file rate limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
csteph9 committed Dec 19, 2023
1 parent 57d0b4a commit b9139c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const csv = require('csv-parser');
const config = require('./config.js');
const engines = require('consolidate');
const fsan = require('sanitize-filename');
const fileRateLimit = require("./resources/rateLimiter");

const pool = mysql.createPool({
host: config.host,
Expand All @@ -26,6 +27,8 @@ const pool = mysql.createPool({

app.use(express.static('resources'));
app.use(cors());


app.engine('html', engines.mustache);
app.set('view engine', 'html');
app.set('views', __dirname + '/resources');
Expand Down Expand Up @@ -93,7 +96,7 @@ app.get('/app', function (req, res) {

})

app.get('/file', function(req, res) {
app.get('/file', fileRateLimit, (req, res) => {

switch( req.query.p )
{
Expand All @@ -103,7 +106,7 @@ app.get('/file', function(req, res) {

})

app.post('/file', upload.single('file'), function(req, res){
app.post('/file', fileRateLimit, upload.single('file'), function(req, res){

switch( req.body.upload_type )
{
Expand Down

0 comments on commit b9139c8

Please sign in to comment.