-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
43 lines (35 loc) · 1.07 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using JobSearchServer.Data;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
var connectionString = "server=localhost;port=3306;database=JobsDatabase;user=root;password=G0l14rd$25";
builder.Services
.AddDbContext<ApplicationDbContext>(
options => options
.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString))
.LogTo(Console.WriteLine, LogLevel.Information)
.EnableSensitiveDataLogging()
.EnableDetailedErrors()
)
.AddGraphQLServer()
.AddMutationConventions()
.AddFiltering()
.AddSorting()
.AddProjections()
// The name of this function changes with the project name.
.AddJobSearchServerTypes();
builder
.Services
.AddCors(options =>
{
options.AddDefaultPolicy(builder =>
{
builder
.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod();
});
});
var app = builder.Build();
app.UseCors();
app.MapGraphQL();
await app.RunWithGraphQLCommandsAsync(args);