diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Database/Database.csproj | 6 | ||||
-rw-r--r-- | Server/.vscode/launch.json | 46 | ||||
-rw-r--r-- | Server/.vscode/tasks.json | 15 | ||||
-rw-r--r-- | Server/Program.cs | 21 | ||||
-rw-r--r-- | Server/Server.csproj | 20 | ||||
-rw-r--r-- | Server/Startup.cs | 48 | ||||
-rw-r--r-- | Server/wwwroot/css/main.css | 0 | ||||
-rw-r--r-- | Server/wwwroot/index.html | 18 | ||||
-rw-r--r-- | Server/wwwroot/scripts/main.ts | 8 | ||||
-rw-r--r-- | Server/wwwroot/tsconfig.json | 8 |
11 files changed, 188 insertions, 3 deletions
@@ -1,5 +1,6 @@ *.js *.map +appsettings.* details.json appsettings.json appsettings.Development.json diff --git a/Database/Database.csproj b/Database/Database.csproj index b6357e8..ab95e73 100644 --- a/Database/Database.csproj +++ b/Database/Database.csproj @@ -6,9 +6,9 @@ </PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.1" />
- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.1" />
- <PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.15" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.4" />
+ <PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>
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..9db50bb --- /dev/null +++ b/Server/Program.cs @@ -0,0 +1,21 @@ +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..fb94fca --- /dev/null +++ b/Server/Server.csproj @@ -0,0 +1,20 @@ +<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" />
+ <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>
+
+</Project>
diff --git a/Server/Startup.cs b/Server/Startup.cs new file mode 100644 index 0000000..93bae2d --- /dev/null +++ b/Server/Startup.cs @@ -0,0 +1,48 @@ +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 {
+ public Startup(IConfiguration configuration) {
+ Configuration = configuration;
+ }
+
+ public IConfiguration Configuration { get; }
+
+ public void ConfigureServices(IServiceCollection services) {
+ services.Configure<CookiePolicyOptions>(options => {
+ options.CheckConsentNeeded = context => true;
+ options.MinimumSameSitePolicy = SameSiteMode.None;
+ });
+
+ services.AddDbContext<DatabaseContext>(options => {
+ options.UseMySQL(Configuration.GetConnectionString("connectionString"));
+ });
+ }
+
+ public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
+ if (env.IsDevelopment()) {
+ app.UseDeveloperExceptionPage();
+ }
+ else {
+ app.UseExceptionHandler("/Error");
+ app.UseHsts();
+ }
+
+ app.UseDefaultFiles();
+ app.UseStaticFiles();
+ }
+ }
+}
diff --git a/Server/wwwroot/css/main.css b/Server/wwwroot/css/main.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Server/wwwroot/css/main.css diff --git a/Server/wwwroot/index.html b/Server/wwwroot/index.html new file mode 100644 index 0000000..cd392d4 --- /dev/null +++ b/Server/wwwroot/index.html @@ -0,0 +1,18 @@ +<!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="css/main.css"> + <script src="js/main.js"></script> +</head> + +<body> + <div class="app"> + </div> +</body> + +</html>
\ No newline at end of file diff --git a/Server/wwwroot/scripts/main.ts b/Server/wwwroot/scripts/main.ts new file mode 100644 index 0000000..77a80d3 --- /dev/null +++ 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 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 |