-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
34 lines (26 loc) · 874 Bytes
/
app.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
const express = require('express');
const app = express();
const port = 3000;
const path = require('path');
const router = express.Router();
// set up rate limiter: maximum of five requests per minute
var rateLimit = require('express-rate-limit');
var limiter = rateLimit({
windowMs: 1 * 60 * 1000, // 1 minute
max: 50,
});
// apply rate limiter to all requests
app.use(limiter);
//add the router
app.use('/', router);
app.use('/distribution', express.static(__dirname + '/distribution'));
router.get('/', function (req, res) {
//__dirname : It will resolve to your project folder.
res.sendFile(path.join(__dirname + '/index.html'));
});
router.get('/iframe', function (req, res) {
res.sendFile(path.join(__dirname + '/iframe.html'));
});
app.listen(process.env.port || 3000, () => {
console.log(`Example app listening at http://localhost:${port}`);
});