diff options
author | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-18 16:44:35 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-18 16:44:35 +0000 |
commit | 92e5978cf1cf54ff587ee93dcbcb5f5dc05ea55c (patch) | |
tree | e4a69853248bebb596035c3bf9418e0048de1d2c | |
parent | e91a06475da796ee2393af174ee31c702a2c8966 (diff) | |
download | newsaggregator-92e5978cf1cf54ff587ee93dcbcb5f5dc05ea55c.tar.gz newsaggregator-92e5978cf1cf54ff587ee93dcbcb5f5dc05ea55c.tar.bz2 newsaggregator-92e5978cf1cf54ff587ee93dcbcb5f5dc05ea55c.zip |
Deleted main console program, and moved server to main
-rw-r--r-- | Main/.vscode/launch.json | 28 | ||||
-rw-r--r-- | Main/.vscode/tasks.json | 2 | ||||
-rw-r--r-- | Main/Main.csproj | 23 | ||||
-rw-r--r-- | Main/Program.cs | 58 | ||||
-rw-r--r-- | Main/Startup.cs (renamed from Server/Startup.cs) | 1 | ||||
-rw-r--r-- | Main/wwwroot/css/main.css (renamed from Server/wwwroot/css/main.css) | 0 | ||||
-rw-r--r-- | Main/wwwroot/index.html (renamed from Server/wwwroot/index.html) | 0 | ||||
-rw-r--r-- | Main/wwwroot/scripts/main.ts (renamed from Server/wwwroot/scripts/main.ts) | 0 | ||||
-rw-r--r-- | Main/wwwroot/tsconfig.json (renamed from Server/wwwroot/tsconfig.json) | 0 | ||||
-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 |
13 files changed, 50 insertions, 164 deletions
diff --git a/Main/.vscode/launch.json b/Main/.vscode/launch.json index 618a536..7a4e712 100644 --- a/Main/.vscode/launch.json +++ b/Main/.vscode/launch.json @@ -5,18 +5,36 @@ "version": "0.2.0", "configurations": [ { - "name": ".NET Core Launch (console)", + "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/Main.dll", + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/Server.dll", "args": [], "cwd": "${workspaceFolder}", - // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window - "console": "externalTerminal", "stopAtEntry": false, - "internalConsoleOptions": "openOnSessionStart" + "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", diff --git a/Main/.vscode/tasks.json b/Main/.vscode/tasks.json index 9f2ef21..93c8951 100644 --- a/Main/.vscode/tasks.json +++ b/Main/.vscode/tasks.json @@ -7,7 +7,7 @@ "type": "process", "args": [ "build", - "${workspaceFolder}/Main.csproj" + "${workspaceFolder}/Server.csproj" ], "problemMatcher": "$msCompile" } diff --git a/Main/Main.csproj b/Main/Main.csproj index d132460..fb94fca 100644 --- a/Main/Main.csproj +++ b/Main/Main.csproj @@ -1,4 +1,15 @@ -<Project Sdk="Microsoft.NET.Sdk">
+<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" />
@@ -6,14 +17,4 @@ <ProjectReference Include="..\Database\Database.csproj" />
</ItemGroup>
- <ItemGroup> - <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.1" /> - </ItemGroup>
-
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>netcoreapp2.1</TargetFramework>
- <LangVersion>Latest</LangVersion>
- </PropertyGroup>
-
</Project>
diff --git a/Main/Program.cs b/Main/Program.cs index 3d56b36..9db50bb 100644 --- a/Main/Program.cs +++ b/Main/Program.cs @@ -1,51 +1,21 @@ using System;
+using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using System.Collections.Generic;
-
-using Database;
-using Classes;
-using Aggregator.Parser;
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
-namespace Main {
- internal static class Program {
- private static async Task Main(string[] args) {
- List<Config> configs = new List<Config>() {
- new Config() { //BBC
- Source = "BBC",
- Title = 0,
- Description = 1,
- ArticleLink = 2,
- ImageLink = 5,
- PublishDate = 4
- },
- new Config(){ //Sky
- Source = "Sky",
- Title = 0,
- Description = 2,
- ArticleLink = 1,
- ImageLink = 7,
- PublishDate = 3
- },
- new Config(){ //ABC
- Source = "ABC",
- Title = 7,
- Description = 11,
- ArticleLink = 8,
- ImageLink = 0,
- PublishDate = 10
- }
- };
- string[] xmls = new[] {
- await Download.DownloadXML("http://feeds.bbci.co.uk/news/rss.xml"),
- await Download.DownloadXML("http://feeds.skynews.com/feeds/rss/world.xml"),
- await Download.DownloadXML("https://abcnews.go.com/abcnews/topstories")
- };
- List<Article> articles = ParserService.ParseMultiple(xmls, configs).ToList();
-
- using (var db = new DatabaseContext()) {
- await db.InsertArticles(articles);
- }
+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/Startup.cs b/Main/Startup.cs index 93bae2d..7314290 100644 --- a/Server/Startup.cs +++ b/Main/Startup.cs @@ -42,7 +42,6 @@ namespace Server { }
app.UseDefaultFiles();
- app.UseStaticFiles();
}
}
}
diff --git a/Server/wwwroot/css/main.css b/Main/wwwroot/css/main.css index e69de29..e69de29 100644 --- a/Server/wwwroot/css/main.css +++ b/Main/wwwroot/css/main.css diff --git a/Server/wwwroot/index.html b/Main/wwwroot/index.html index cd392d4..cd392d4 100644 --- a/Server/wwwroot/index.html +++ b/Main/wwwroot/index.html diff --git a/Server/wwwroot/scripts/main.ts b/Main/wwwroot/scripts/main.ts index 77a80d3..77a80d3 100644 --- a/Server/wwwroot/scripts/main.ts +++ b/Main/wwwroot/scripts/main.ts diff --git a/Server/wwwroot/tsconfig.json b/Main/wwwroot/tsconfig.json index 89d01c4..89d01c4 100644 --- a/Server/wwwroot/tsconfig.json +++ b/Main/wwwroot/tsconfig.json diff --git a/Server/.vscode/launch.json b/Server/.vscode/launch.json deleted file mode 100644 index 7a4e712..0000000 --- a/Server/.vscode/launch.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - // 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 deleted file mode 100644 index 93c8951..0000000 --- a/Server/.vscode/tasks.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "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 deleted file mode 100644 index 9db50bb..0000000 --- a/Server/Program.cs +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index fb94fca..0000000 --- a/Server/Server.csproj +++ /dev/null @@ -1,20 +0,0 @@ -<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>
|