From f80e509895b7b2c1d716ac276977b7165a13c192 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Fri, 6 Oct 2023 12:34:36 +0100 Subject: Typescript migration --- src/app.js | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100755 src/app.js (limited to 'src/app.js') diff --git a/src/app.js b/src/app.js deleted file mode 100755 index 9feb239..0000000 --- a/src/app.js +++ /dev/null @@ -1,50 +0,0 @@ -import express from "express"; -import routes from "./routes.js"; -import hbs from "express-handlebars"; -import bodyParser from "body-parser"; - -const app = express(); - -// Configuration // - -//app.use(cors()); -//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 - }, - }, -}); -app.engine("handlebars", hbsInstance.engine); -app.set("view engine", "handlebars"); -app.set("hbsInstance", hbsInstance); - -// Static files // - -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); - -export default app; -- cgit v1.2.3