Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

basic-auth.js 661B

1234567891011121314151617181920212223242526272829
  1. const path = require("path");
  2. const auth = require("express-basic-auth");
  3. const express = require("express");
  4. const app = express();
  5. const basicAuth = auth({
  6. realm: "MagicMirror Area restricted.",
  7. users: { MagicMirror: "CallMeADog" }
  8. });
  9. app.use(basicAuth);
  10. // Set available directories
  11. const directories = ["/tests/configs"];
  12. const rootPath = path.resolve(__dirname + "/../../../");
  13. for (let directory of directories) {
  14. app.use(directory, express.static(path.resolve(rootPath + directory)));
  15. }
  16. let server;
  17. exports.listen = function () {
  18. server = app.listen.apply(app, arguments);
  19. };
  20. exports.close = function (callback) {
  21. server.close(callback);
  22. };