UNPKG

md-toy-blog

Version:

Very simple Markdown blog: serves your md as html without fancy databases. You will only spend time writing the actual data.

42 lines (41 loc) 1.81 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var RoutePathValidator_1 = __importDefault(require("./RoutePathValidator")); var BlogPostRoute = /** @class */ (function (_super) { __extends(BlogPostRoute, _super); function BlogPostRoute(config) { var _this = _super.call(this, config) || this; _this.config = config; _this.controller = config.controller; return _this; } BlogPostRoute.prototype.getControllerActionParams = function (_a) { var request = _a.request; return { postSlug: this.getRequestedPostSlug(request, this.paths) }; }; BlogPostRoute.prototype.isValid = function (req) { return this.config.validPostSlugList.indexOf(this.getRequestedPostSlug(req, this.paths)) >= 0; }; BlogPostRoute.prototype.getRequestedPostSlug = function (req, paths) { var _a = req.url.split(paths[0]), postSlug = _a[1]; return postSlug; }; return BlogPostRoute; }(RoutePathValidator_1.default)); exports.default = BlogPostRoute;