コード例 #1
0
        /// <summary>
        /// Creates a new instance of the JsxFileMiddleware.
        /// </summary>
        /// <param name="next">The next middleware in the pipeline.</param>
        /// <param name="options">The configuration options.</param>
        public JsxFileMiddleware(Func <IDictionary <string, object>, Task> next, JsxFileOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException("next");
            }

            _next = next;

            // Default values
            _options = options ?? new JsxFileOptions();
        }
コード例 #2
0
        /// <summary>
        /// Creates a new instance of the JsxFileMiddleware.
        /// </summary>
        /// <param name="next">The next middleware in the pipeline.</param>
        /// <param name="options">The configuration options.</param>
        public JsxFileMiddleware(Func <IDictionary <string, object>, Task> next, JsxFileOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException("next");
            }

            _next = next;

            // Default values
            options      = options ?? new JsxFileOptions();
            _extensions  = (options.Extensions == null || !options.Extensions.Any()) ? new[] { ".jsx", ".js" } : options.Extensions;
            _fileOptions = options.StaticFileOptions ?? new StaticFileOptions();
        }
コード例 #3
0
 /// <summary>
 /// Enables serving static JSX file, compiled to JavaScript with the given options.
 /// </summary>
 public static IAppBuilder UseJsxFiles(this IAppBuilder builder, JsxFileOptions options = null)
 {
     return(builder.Use <JsxFileMiddleware>(options ?? new JsxFileOptions()));
 }