Example #1
0
        public static void Init()
        {
            using (var conn = SqliteUtil.GetConn())
            {
                conn.Open();

                // create database if it doesn't exist
                var cmd = new SqliteCommand(@"
					CREATE TABLE IF NOT EXISTS Articles (
						FeedUrl TEXT, 
						ArticleUrl TEXT, 
						LastFetchedUTC DATETIME, 
						Content TEXT,
						Readable BOOLEAN
					);"                    , conn);
                cmd.ExecuteNonQuery();

                //// reset (if you pollute the cache by mistake)
                //var delCmd = new SqliteCommand("DELETE FROM Articles",conn);
                //delCmd.ExecuteNonQuery();
            }
        }
Example #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            // enable rate limiter
            app.UseIpRateLimiting();

            // shoe errors
            app.UseDeveloperExceptionPage();

            // set up controller
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
            app.UseStaticFiles();

            // configure feedability database
            SqliteUtil.Init();
        }