summaryrefslogtreecommitdiff
path: root/src/app.js
diff options
context:
space:
mode:
authorRaphael Kabo <raphaelkabo@hey.com>2023-05-12 16:54:06 +0100
committerRaphael Kabo <raphaelkabo@hey.com>2023-05-12 16:54:06 +0100
commit453c08463bf46e568c8a5018416ad88498a73f29 (patch)
tree831ba6543b21997beb237441ad752eb8fc76a0b2 /src/app.js
parent57545c3a3eda30a1ef6ece10090a6b0fb69a29a7 (diff)
linting: source files
Diffstat (limited to 'src/app.js')
-rwxr-xr-xsrc/app.js65
1 files changed, 32 insertions, 33 deletions
diff --git a/src/app.js b/src/app.js
index cc50593..4a2137e 100755
--- a/src/app.js
+++ b/src/app.js
@@ -1,10 +1,10 @@
-const express = require('express');
-const path = require('path');
-const session = require('express-session');
-const cors = require('cors');
-const routes = require('./routes');
-const hbs = require('express-handlebars');
-const bodyParser = require('body-parser');
+const express = require("express");
+const path = require("path");
+const session = require("express-session");
+const cors = require("cors");
+const routes = require("./routes");
+const hbs = require("express-handlebars");
+const bodyParser = require("body-parser");
const app = express();
@@ -14,41 +14,40 @@ const app = express();
//app.use(bodyParser.json());
//app.use(session({ secret: 'slartibartfast', cookie: { maxAge: 60000 }, resave: false, saveUninitialized: false }));
-
// View engine //
const hbsInstance = hbs.create({
- defaultLayout: 'main',
- partialsDir: ['views/partials/'],
- layoutsDir: 'views/layouts/',
- helpers: {
- plural: function(number, text) {
- var singular = number === 1;
- // If no text parameter was given, just return a conditional s.
- if (typeof text !== 'string') return singular ? '' : 's';
- // Split with regex into group1/group2 or group1(group3)
- var match = text.match(/^([^()\/]+)(?:\/(.+))?(?:\((\w+)\))?/);
- // If no match, just append a conditional s.
- if (!match) return text + (singular ? '' : 's');
- // We have a good match, so fire away
- return singular && match[1] // Singular case
- ||
- match[2] // Plural case: 'bagel/bagels' --> bagels
- ||
- match[1] + (match[3] || 's'); // Plural case: 'bagel(s)' or 'bagel' --> bagels
- }
- }
+ defaultLayout: "main",
+ partialsDir: ["views/partials/"],
+ layoutsDir: "views/layouts/",
+ helpers: {
+ plural: function (number, text) {
+ var singular = number === 1;
+ // If no text parameter was given, just return a conditional s.
+ if (typeof text !== "string") return singular ? "" : "s";
+ // Split with regex into group1/group2 or group1(group3)
+ var match = text.match(/^([^()\/]+)(?:\/(.+))?(?:\((\w+)\))?/);
+ // If no match, just append a conditional s.
+ if (!match) return text + (singular ? "" : "s");
+ // We have a good match, so fire away
+ return (
+ (singular && match[1]) || // Singular case
+ match[2] || // Plural case: 'bagel/bagels' --> bagels
+ match[1] + (match[3] || "s")
+ ); // Plural case: 'bagel(s)' or 'bagel' --> bagels
+ },
+ },
});
-app.engine('handlebars', hbsInstance.engine);
-app.set('view engine', 'handlebars');
-app.set('hbsInstance', hbsInstance);
+app.engine("handlebars", hbsInstance.engine);
+app.set("view engine", "handlebars");
+app.set("hbsInstance", hbsInstance);
// Static files //
-app.use(express.static('public'));
+app.use(express.static("public"));
// Router //
app.use(bodyParser.json({ type: "application/activity+json" })); // support json encoded bodies
app.use(bodyParser.urlencoded({ extended: true }));
-app.use('/', routes);
+app.use("/", routes);
module.exports = app;