From ce81b993fd271be9552799eabb324d5c7ca1c5bb Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Sun, 10 Feb 2019 23:03:55 +0000
Subject: Made project for ASP.NET server

---
 Server/.vscode/launch.json | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 Server/.vscode/tasks.json  | 15 +++++++++++++++
 Server/Program.cs          | 24 ++++++++++++++++++++++++
 Server/Server.csproj       | 12 ++++++++++++
 Server/Startup.cs          | 41 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 138 insertions(+)
 create mode 100644 Server/.vscode/launch.json
 create mode 100644 Server/.vscode/tasks.json
 create mode 100644 Server/Program.cs
 create mode 100644 Server/Server.csproj
 create mode 100644 Server/Startup.cs

(limited to 'Server')

diff --git a/Server/.vscode/launch.json b/Server/.vscode/launch.json
new file mode 100644
index 0000000..7a4e712
--- /dev/null
+++ b/Server/.vscode/launch.json
@@ -0,0 +1,46 @@
+{
+   // Use IntelliSense to find out which attributes exist for C# debugging
+   // Use hover for the description of the existing attributes
+   // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
+   "version": "0.2.0",
+   "configurations": [
+        {
+            "name": ".NET Core Launch (web)",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build",
+            // If you have changed target frameworks, make sure to update the program path.
+            "program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/Server.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}",
+            "stopAtEntry": false,
+            "internalConsoleOptions": "openOnSessionStart",
+            "launchBrowser": {
+                "enabled": true,
+                "args": "${auto-detect-url}",
+                "windows": {
+                    "command": "cmd.exe",
+                    "args": "/C start ${auto-detect-url}"
+                },
+                "osx": {
+                    "command": "open"
+                },
+                "linux": {
+                    "command": "xdg-open"
+                }
+            },
+            "env": {
+                "ASPNETCORE_ENVIRONMENT": "Development"
+            },
+            "sourceFileMap": {
+                "/Views": "${workspaceFolder}/Views"
+            }
+        },
+        {
+            "name": ".NET Core Attach",
+            "type": "coreclr",
+            "request": "attach",
+            "processId": "${command:pickProcess}"
+        }
+    ,]
+}
\ No newline at end of file
diff --git a/Server/.vscode/tasks.json b/Server/.vscode/tasks.json
new file mode 100644
index 0000000..93c8951
--- /dev/null
+++ b/Server/.vscode/tasks.json
@@ -0,0 +1,15 @@
+{
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "build",
+            "command": "dotnet",
+            "type": "process",
+            "args": [
+                "build",
+                "${workspaceFolder}/Server.csproj"
+            ],
+            "problemMatcher": "$msCompile"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/Server/Program.cs b/Server/Program.cs
new file mode 100644
index 0000000..4144500
--- /dev/null
+++ b/Server/Program.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
+
+namespace Server
+{
+    public class Program
+    {
+        public static void Main(string[] args)
+        {
+            CreateWebHostBuilder(args).Build().Run();
+        }
+
+        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
+            WebHost.CreateDefaultBuilder(args)
+                .UseStartup<Startup>();
+    }
+}
diff --git a/Server/Server.csproj b/Server/Server.csproj
new file mode 100644
index 0000000..ed02613
--- /dev/null
+++ b/Server/Server.csproj
@@ -0,0 +1,12 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.AspNetCore.App" />
+    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
+  </ItemGroup>
+
+</Project>
diff --git a/Server/Startup.cs b/Server/Startup.cs
new file mode 100644
index 0000000..08d1df4
--- /dev/null
+++ b/Server/Startup.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Server {
+    public class Startup {
+        public Startup(IConfiguration configuration) {
+            Configuration = configuration;
+        }
+
+        public IConfiguration Configuration { get; }
+
+        // This method gets called by the runtime. Use this method to add services to the container.
+        public void ConfigureServices(IServiceCollection services) {
+            services.Configure<CookiePolicyOptions>(options => {
+                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
+                options.CheckConsentNeeded = context => true;
+                options.MinimumSameSitePolicy = SameSiteMode.None;
+            });
+        }
+
+        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+        public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
+            if (env.IsDevelopment()) {
+                app.UseDeveloperExceptionPage();
+            }
+            else {
+                app.UseExceptionHandler("/Error");
+                app.UseHsts();
+            }
+
+            app.UseHttpsRedirection();
+            app.UseStaticFiles();
+            app.UseCookiePolicy();
+        }
+    }
+}
-- 
cgit v1.2.3-13-gbd6f


From a10b0ea63b09fe232fab2da99ec072d32e2a363d Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Sun, 10 Feb 2019 23:05:22 +0000
Subject: Added reference to parser, classes and database context

---
 Server/Server.csproj | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'Server')

diff --git a/Server/Server.csproj b/Server/Server.csproj
index ed02613..488c2a4 100644
--- a/Server/Server.csproj
+++ b/Server/Server.csproj
@@ -9,4 +9,10 @@
     <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
   </ItemGroup>
 
+  <ItemGroup>
+    <ProjectReference Include="..\Classes\Classes.csproj" />
+    <ProjectReference Include="..\Aggregator\Parser\Parser.csproj" />
+    <ProjectReference Include="..\Database\Database.csproj" />
+  </ItemGroup>
+
 </Project>
-- 
cgit v1.2.3-13-gbd6f


From 57b29125e270d847bbbef059240f385d04dc9cd2 Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Sun, 10 Feb 2019 23:20:51 +0000
Subject: Messed around with dependencies and got best outcome for mySQL
 support to work

---
 Server/Server.csproj | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'Server')

diff --git a/Server/Server.csproj b/Server/Server.csproj
index 488c2a4..fb94fca 100644
--- a/Server/Server.csproj
+++ b/Server/Server.csproj
@@ -7,12 +7,14 @@
   <ItemGroup>
     <PackageReference Include="Microsoft.AspNetCore.App" />
     <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
+    <PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.11" />
   </ItemGroup>
 
-  <ItemGroup>
-    <ProjectReference Include="..\Classes\Classes.csproj" />
-    <ProjectReference Include="..\Aggregator\Parser\Parser.csproj" />
-    <ProjectReference Include="..\Database\Database.csproj" />
+  <ItemGroup>
+    <ProjectReference Include="..\Classes\Classes.csproj" />
+    <ProjectReference Include="..\Aggregator\Parser\Parser.csproj" />
+    <ProjectReference Include="..\Database\Database.csproj" />
   </ItemGroup>
 
 </Project>
-- 
cgit v1.2.3-13-gbd6f


From 9ea5adbe56de3d3b708ab5f90f786d18670e4643 Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Sun, 10 Feb 2019 23:28:14 +0000
Subject: setup basic configuration for index.html

---
 Server/Startup.cs | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

(limited to 'Server')

diff --git a/Server/Startup.cs b/Server/Startup.cs
index 08d1df4..93bae2d 100644
--- a/Server/Startup.cs
+++ b/Server/Startup.cs
@@ -1,10 +1,17 @@
 using System;
 using System.Collections.Generic;
+
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+using Classes;
+using Database;
+using Aggregator.Parser;
 
 namespace Server {
     public class Startup {
@@ -14,16 +21,17 @@ namespace Server {
 
         public IConfiguration Configuration { get; }
 
-        // This method gets called by the runtime. Use this method to add services to the container.
         public void ConfigureServices(IServiceCollection services) {
             services.Configure<CookiePolicyOptions>(options => {
-                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                 options.CheckConsentNeeded = context => true;
                 options.MinimumSameSitePolicy = SameSiteMode.None;
             });
+
+            services.AddDbContext<DatabaseContext>(options => {
+                options.UseMySQL(Configuration.GetConnectionString("connectionString"));
+            });
         }
 
-        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
         public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
             if (env.IsDevelopment()) {
                 app.UseDeveloperExceptionPage();
@@ -33,9 +41,8 @@ namespace Server {
                 app.UseHsts();
             }
 
-            app.UseHttpsRedirection();
+            app.UseDefaultFiles();
             app.UseStaticFiles();
-            app.UseCookiePolicy();
         }
     }
 }
-- 
cgit v1.2.3-13-gbd6f


From abc2953532c9b2522c51683ba31e3168854fcf6b Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Sun, 10 Feb 2019 23:28:22 +0000
Subject: Created basic test html file

---
 Server/wwwroot/index.html | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Server/wwwroot/index.html

(limited to 'Server')

diff --git a/Server/wwwroot/index.html b/Server/wwwroot/index.html
new file mode 100644
index 0000000..8be3289
--- /dev/null
+++ b/Server/wwwroot/index.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <title>Page Title</title>
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <link rel="stylesheet" type="text/css" media="screen" href="main.css">
+  <script src="main.js"></script>
+</head>
+<body>
+  <p>test</p>
+</body>
+</html>
\ No newline at end of file
-- 
cgit v1.2.3-13-gbd6f


From ad87992aedee7dca4c784f867fffb2ade05aeb9b Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Mon, 11 Feb 2019 15:41:41 +0000
Subject: Formatted code for Program.cs

---
 Server/Program.cs | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

(limited to 'Server')

diff --git a/Server/Program.cs b/Server/Program.cs
index 4144500..9db50bb 100644
--- a/Server/Program.cs
+++ b/Server/Program.cs
@@ -8,12 +8,9 @@ using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Logging;
 
-namespace Server
-{
-    public class Program
-    {
-        public static void Main(string[] args)
-        {
+namespace Server {
+    public class Program {
+        public static void Main(string[] args) {
             CreateWebHostBuilder(args).Build().Run();
         }
 
-- 
cgit v1.2.3-13-gbd6f


From 6611db6472aa4efd406abe940b402d9416b86410 Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Mon, 11 Feb 2019 15:43:54 +0000
Subject: Added tsconfig.json to compile typescript

---
 Server/wwwroot/tsconfig.json | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 Server/wwwroot/tsconfig.json

(limited to 'Server')

diff --git a/Server/wwwroot/tsconfig.json b/Server/wwwroot/tsconfig.json
new file mode 100644
index 0000000..89d01c4
--- /dev/null
+++ b/Server/wwwroot/tsconfig.json
@@ -0,0 +1,8 @@
+{
+    "compilerOptions": {
+        "module": "commonjs",
+        "target": "esnext",
+        "sourceMap": true,
+        "outDir": "js/"
+    }
+}
\ No newline at end of file
-- 
cgit v1.2.3-13-gbd6f


From 1e666ca1273a1c12bb15e4f5b0eda6c8b97cce43 Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Mon, 11 Feb 2019 15:44:16 +0000
Subject: Made main files

---
 Server/wwwroot/css/main.css    | 0
 Server/wwwroot/scripts/main.ts | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 Server/wwwroot/css/main.css
 create mode 100644 Server/wwwroot/scripts/main.ts

(limited to 'Server')

diff --git a/Server/wwwroot/css/main.css b/Server/wwwroot/css/main.css
new file mode 100644
index 0000000..e69de29
diff --git a/Server/wwwroot/scripts/main.ts b/Server/wwwroot/scripts/main.ts
new file mode 100644
index 0000000..e69de29
-- 
cgit v1.2.3-13-gbd6f


From 9d0351289ba040ddb788c45a05089271bdf4524e Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Mon, 11 Feb 2019 15:45:18 +0000
Subject: Made div to hold main app, dynamic content will be placed in this

---
 Server/wwwroot/index.html | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'Server')

diff --git a/Server/wwwroot/index.html b/Server/wwwroot/index.html
index 8be3289..28d4f8c 100644
--- a/Server/wwwroot/index.html
+++ b/Server/wwwroot/index.html
@@ -1,5 +1,6 @@
 <!DOCTYPE html>
 <html>
+
 <head>
   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -8,7 +9,10 @@
   <link rel="stylesheet" type="text/css" media="screen" href="main.css">
   <script src="main.js"></script>
 </head>
+
 <body>
-  <p>test</p>
+  <div class="app">
+  </div>
 </body>
+
 </html>
\ No newline at end of file
-- 
cgit v1.2.3-13-gbd6f


From 687b233da16ec91d275f60825530f4075859be45 Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Mon, 11 Feb 2019 15:47:12 +0000
Subject: Setup proper links to scripts and css

---
 Server/wwwroot/index.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'Server')

diff --git a/Server/wwwroot/index.html b/Server/wwwroot/index.html
index 28d4f8c..cd392d4 100644
--- a/Server/wwwroot/index.html
+++ b/Server/wwwroot/index.html
@@ -6,8 +6,8 @@
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <title>Page Title</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  <link rel="stylesheet" type="text/css" media="screen" href="main.css">
-  <script src="main.js"></script>
+  <link rel="stylesheet" type="text/css" media="screen" href="css/main.css">
+  <script src="js/main.js"></script>
 </head>
 
 <body>
-- 
cgit v1.2.3-13-gbd6f


From c94ca254d8ed2a4f29f49f5de0a8e542c73230b7 Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadevchavali1@gmail.com>
Date: Mon, 11 Feb 2019 15:48:39 +0000
Subject: Created basic class to hold a single article

---
 Server/wwwroot/scripts/main.ts | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'Server')

diff --git a/Server/wwwroot/scripts/main.ts b/Server/wwwroot/scripts/main.ts
index e69de29..77a80d3 100644
--- a/Server/wwwroot/scripts/main.ts
+++ b/Server/wwwroot/scripts/main.ts
@@ -0,0 +1,8 @@
+var root = document.getElementsByClassName('app');
+
+class Article {
+  Title: HTMLElement;
+  Description: string;
+  ArticleLink: string;
+  Image: HTMLElement;
+}
\ No newline at end of file
-- 
cgit v1.2.3-13-gbd6f