mirror of
https://github.com/sphildreth/roadie
synced 2024-11-26 06:00:23 +00:00
CORS setup for API get detail preflights
This commit is contained in:
parent
6c3d92d49d
commit
d6c5fbe7dc
4 changed files with 25 additions and 13 deletions
|
@ -80,6 +80,7 @@ namespace Roadie.Api.Services
|
|||
this._configuration = configuration;
|
||||
this._httpEncoder = httpEncoder;
|
||||
this._dbContext = context;
|
||||
// this._dbContext.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
||||
this._cacheManager = cacheManager;
|
||||
this._logger = logger;
|
||||
this._httpContext = httpContext;
|
||||
|
|
|
@ -62,12 +62,7 @@ namespace Roadie.Api
|
|||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
// global cors policy
|
||||
app.UseCors(x => x
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.AllowCredentials());
|
||||
app.UseCors("CORSPolicy");
|
||||
|
||||
app.UseAuthentication();
|
||||
//app.UseSwagger();
|
||||
|
@ -90,15 +85,15 @@ namespace Roadie.Api
|
|||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddCors(options => options.AddPolicy("Cors", builder =>
|
||||
services.AddCors(options => options.AddPolicy("CORSPolicy", builder =>
|
||||
{
|
||||
builder
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader();
|
||||
.AllowCredentials();
|
||||
}));
|
||||
|
||||
|
||||
services.AddSingleton<ITokenService, TokenService>();
|
||||
|
||||
services.AddSingleton<IHttpEncoder, HttpEncoder>();
|
||||
|
|
|
@ -122,5 +122,11 @@ namespace Roadie.Library.Identity
|
|||
public virtual ICollection<UserQue> UserQues { get; set; }
|
||||
|
||||
public virtual ICollection<ApplicationUserRole> UserRoles { get; set; }
|
||||
|
||||
//public ICollection<ChatMessage> ChatMessages { get; set; }
|
||||
//public ICollection<Collection> Collections { get; set; }
|
||||
//public ICollection<Submission> Submission { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using Roadie.Library.Enums;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
@ -65,6 +66,15 @@ namespace Roadie.Library.Identity
|
|||
this.RecentlyPlayedLimit = 20;
|
||||
this.RandomReleaseLimit = 20;
|
||||
|
||||
// Collections = new HashSet<Collection>();
|
||||
Playlists = new HashSet<Playlist>();
|
||||
Requests = new HashSet<Request>();
|
||||
Submissions = new HashSet<Submission>();
|
||||
UserQues = new HashSet<UserQue>();
|
||||
ArtistRatings = new HashSet<UserArtist>();
|
||||
ReleaseRatings = new HashSet<UserRelease>();
|
||||
TrackRatings = new HashSet<UserTrack>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue