diff options
author | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-10 23:03:55 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-10 23:03:55 +0000 |
commit | ce81b993fd271be9552799eabb324d5c7ca1c5bb (patch) | |
tree | 324ace8b17c07bd53829f4e26a524727dbee3ec4 | |
parent | 6f3c6b4e4980dbff22cbe746188eae4b52b0aad2 (diff) | |
download | newsaggregator-ce81b993fd271be9552799eabb324d5c7ca1c5bb.tar.gz newsaggregator-ce81b993fd271be9552799eabb324d5c7ca1c5bb.tar.bz2 newsaggregator-ce81b993fd271be9552799eabb324d5c7ca1c5bb.zip |
Made project for ASP.NET server
-rw-r--r-- | Server/.vscode/launch.json | 46 | ||||
-rw-r--r-- | Server/.vscode/tasks.json | 15 | ||||
-rw-r--r-- | Server/Program.cs | 24 | ||||
-rw-r--r-- | Server/Server.csproj | 12 | ||||
-rw-r--r-- | Server/Startup.cs | 41 |
5 files changed, 138 insertions, 0 deletions
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();
+ }
+ }
+}
|