Skip to content

Commit

Permalink
Align Server Template with WebAPI Template (#3573)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-tengler authored Apr 22, 2021
1 parent bbdfe71 commit 0995368
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
8 changes: 1 addition & 7 deletions templates/Server/content/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace HotChocolate.Server.Template
{
Expand Down
20 changes: 10 additions & 10 deletions templates/Server/content/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using HotChocolate.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace HotChocolate.Server.Template
{
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.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
// If you need dependency injection with your query object add your query type as a services.
// services.AddSingleton<Query>();
services
.AddRouting()
.AddGraphQLServer()
.AddQueryType<Query>();
}
Expand All @@ -38,8 +38,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseEndpoints(endpoints =>
{
// By default the GraphQL server is mapped to /graphql
// This route also provides you with our GraphQL IDE. In order to configure the
// the GraphQL IDE use endpoints.MapGraphQL().WithToolOptions(...).
// This route also provides you with our GraphQL IDE.
// In order to configure the GraphQL IDE use endpoints.MapGraphQL().WithToolOptions(...).
endpoints.MapGraphQL();
});
}
Expand Down
9 changes: 9 additions & 0 deletions templates/Server/content/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
10 changes: 10 additions & 0 deletions templates/Server/content/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

0 comments on commit 0995368

Please sign in to comment.