/// <summary>
        /// Templates the README.
        /// </summary>
        /// <returns>
        /// A README with values substituted in the template.
        /// </returns>
        protected static string CreateReadme()
        {
            string source   = FileExtra.GetEmbeddedFile($"Templates{Seperator}README.txt.handlebars");
            var    template = Handlebars.Compile(source);

            var data = new
            {
                id = sessionId,
            };

            return(template(data));
        }
        /// <inheritdoc/>
        public Task Handle(HttpContext ctx)
        {
            string seperator = Path.DirectorySeparatorChar.ToString();
            var    source    = FileExtra.GetEmbeddedFile($"Templates{seperator}ErrorPage.html.handlebars");

            var template = Handlebars.Compile(source);

            var data = new
            {
                statusCode = ctx.Response.StatusCode.ToString(),
            };

            return(ctx.Response.WriteAsync(template(data)));
        }
Exemple #3
0
        public void Configure(IApplicationBuilder app)
        {
            app.UseRouting();

            app.UseSwaggerUI((options) =>
            {
                options.RoutePrefix = "openapi/ui";

                // Because the site will try to get the page from root,
                // We need to direct it to /api/v1
                options.SwaggerEndpoint("/api/v1/openapi", this.appConfig.CarterOptions.OpenApi.DocumentTitle);

                options.DocumentTitle = "Experience Capture API";

                string seperator    = Path.DirectorySeparatorChar.ToString();
                options.HeadContent = FileExtra.GetEmbeddedFile($"Templates{seperator}OpenApiHeader.html");
            });

            app.UseEndpoints(builder => builder.MapCarter());
        }