Update dependencies and fix file paths
This commit is contained in:
@ -1,13 +1,24 @@
|
||||
const express = require("express");
|
||||
const helmet = require("helmet");
|
||||
//const helmet = require("helmet");
|
||||
var cors = require('cors');
|
||||
const { rateLimit } = require("express-rate-limit");
|
||||
const { APIlogger } = require('../middleware/apiLogger.js');
|
||||
const { apikeyCheck } = require('../middleware/apiKey.js');
|
||||
|
||||
const app = express();
|
||||
app.use(helmet());
|
||||
//app.use(cors());
|
||||
//allow cors from localhost:3000
|
||||
//app.use(helmet({ crossOriginResourcePolicy: { policy: "cross-origin" } }));
|
||||
const port = 80;
|
||||
|
||||
// Hold list of functions to run when the server is ready
|
||||
app.onListen = [function(){console.log('hello')}];
|
||||
|
||||
module.exports = app;
|
||||
|
||||
//handle cors
|
||||
|
||||
|
||||
//express-rate-limit stolen from docs
|
||||
const limiter = rateLimit({
|
||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||
@ -73,8 +84,8 @@ app.use(function(err, req, res, next) {
|
||||
keyErrors,
|
||||
});
|
||||
});
|
||||
/*
|
||||
app.listen(port, () => {
|
||||
console.log(`app listening on port ${port}`);
|
||||
});
|
||||
|
||||
module.exports = { app };
|
||||
*/
|
||||
|
@ -10,8 +10,8 @@ const options = {
|
||||
username: process.env.MQTT_USER,
|
||||
password: process.env.MQTT_PASS,
|
||||
protocol: 'mqtts', // Use MQTT over TLS
|
||||
key: fs.readFileSync(path.resolve(__dirname, '../../cert/privkey.pem')),
|
||||
cert: fs.readFileSync(path.resolve(__dirname, '../../cert/cert.pem')),
|
||||
key: fs.readFileSync(path.resolve(__dirname, '../cert/privkey.pem')),
|
||||
cert: fs.readFileSync(path.resolve(__dirname, '../cert/cert.pem')),
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user