main
Last change
on this file since 04008ae was 17d6948, checked in by Nikola Mishevski <Nikola.Mishevski@…>, 6 days ago |
initial commit WineTracker Project
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | namespace WineTrackerWebApi
|
---|
2 | {
|
---|
3 | public class Program
|
---|
4 | {
|
---|
5 | public static void Main(string[] args)
|
---|
6 | {
|
---|
7 | var builder = WebApplication.CreateBuilder(args);
|
---|
8 |
|
---|
9 | // Add services to the container.
|
---|
10 | builder.Services.AddCors(options =>
|
---|
11 | {
|
---|
12 | options.AddPolicy("AllowAll", policy =>
|
---|
13 | {
|
---|
14 | policy.AllowAnyOrigin()
|
---|
15 | .AllowAnyMethod()
|
---|
16 | .AllowAnyHeader();
|
---|
17 | });
|
---|
18 | });
|
---|
19 |
|
---|
20 | builder.Services.AddControllers();
|
---|
21 | // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
---|
22 | builder.Services.AddEndpointsApiExplorer();
|
---|
23 |
|
---|
24 | builder.Services.AddSwaggerGen(c =>
|
---|
25 | {
|
---|
26 | c.CustomSchemaIds(type => type.FullName); // Use fully qualified names as schema IDs
|
---|
27 | });
|
---|
28 |
|
---|
29 | var app = builder.Build();
|
---|
30 |
|
---|
31 | // Configure the HTTP request pipeline.
|
---|
32 | if (app.Environment.IsDevelopment())
|
---|
33 | {
|
---|
34 | app.UseSwagger();
|
---|
35 | app.UseSwaggerUI();
|
---|
36 | }
|
---|
37 |
|
---|
38 | app.UseCors(policy =>
|
---|
39 | policy.AllowAnyOrigin()
|
---|
40 | .AllowAnyMethod()
|
---|
41 | .AllowAnyHeader());
|
---|
42 |
|
---|
43 | app.UseHttpsRedirection();
|
---|
44 |
|
---|
45 | app.UseAuthorization();
|
---|
46 |
|
---|
47 | app.MapControllers();
|
---|
48 |
|
---|
49 | app.Run();
|
---|
50 | }
|
---|
51 | }
|
---|
52 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.