Skip to content

Commit

Permalink
Add sandbox server to the test directory
Browse files Browse the repository at this point in the history
  • Loading branch information
lennym committed Nov 10, 2017
1 parent cb53f58 commit a208035
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<form action="http://localhost:3001" method="post" enctype="multipart/form-data">
<input type="file" name="test" />
<input type="submit" />
</form>
20 changes: 20 additions & 0 deletions test/test-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const app = require('express')();
const path = require('path');
const fs = require('fs');

app.use(require('../')({ limit: '250mb' }));

app.get('/', (req, res) => {
res.sendFile(path.resolve(__dirname, './index.html'));
});

app.post('/', (req, res) => {
if (req.files.test && req.files.test.name) {
res.type(req.files.test.mimetype);
res.send(req.files.test.data);
} else {
res.json(req.files);
}
});

app.listen(3001);

0 comments on commit a208035

Please sign in to comment.