mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
We have used it inconsistently till now. Template literals are more modern and easier to maintain in my opinion. Because that's a large amount of changes, here's a way to reproduce it: I added the rule `"prefer-template": "error"` to the `.eslintrc.json` and did an autofix. Since this caused a new problem in line 409 of `newsfeed.js`, I reversed it in that line and also removed the rule from the eslint config file. The rule is described here: https://eslint.org/docs/latest/rules/prefer-template Note: I've played around with some other linter rules as well, and some seem to point to some specific, non-cosmetic, issues. But before I dive even deeper and then introduce even bigger and hardly understandable changes at once, I thought I'd start with this simple cosmetic rule.
30 lines
665 B
JavaScript
30 lines
665 B
JavaScript
const path = require("path");
|
|
const auth = require("express-basic-auth");
|
|
const express = require("express");
|
|
const app = express();
|
|
|
|
const basicAuth = auth({
|
|
realm: "MagicMirror² Area restricted.",
|
|
users: { MagicMirror: "CallMeADog" }
|
|
});
|
|
|
|
app.use(basicAuth);
|
|
|
|
// Set available directories
|
|
const directories = ["/tests/configs", "/tests/mocks"];
|
|
const rootPath = path.resolve(`${__dirname}/../../../`);
|
|
|
|
for (let directory of directories) {
|
|
app.use(directory, express.static(path.resolve(rootPath + directory)));
|
|
}
|
|
|
|
let server;
|
|
|
|
exports.listen = (...args) => {
|
|
server = app.listen.apply(app, args);
|
|
};
|
|
|
|
exports.close = async () => {
|
|
await server.close();
|
|
};
|