82 lines
3.7 KiB
C#
82 lines
3.7 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.IdentityModel.Tokens;
|
|
using Ocelot.DependencyInjection;
|
|
using Ocelot.Middleware;
|
|
using System.IO;
|
|
|
|
namespace OnlineAssessment.Gateway
|
|
{
|
|
public class Startup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddOcelot();
|
|
}
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
public async void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
{
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
}
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseEndpoints(endpoints =>
|
|
{
|
|
endpoints.MapGet("/", async context =>
|
|
{
|
|
await context.Response.WriteAsync(GetIndexPage());
|
|
});
|
|
});
|
|
|
|
app.UseEndpoints(endpoints =>
|
|
{
|
|
endpoints.MapControllers();
|
|
});
|
|
await app.UseOcelot();
|
|
}
|
|
|
|
public string GetIndexPage()
|
|
{
|
|
string indexFileContent = File.ReadAllText("index.html");
|
|
return indexFileContent;
|
|
//string indexPage = @"
|
|
// <div style='width: 80%; display: block; margin: 100px auto; border: none; text-align:center;font-family: arial'>
|
|
// <img style='height: 80px;' src='https://www.odiware.com/wp-content/uploads/2020/04/color_logo_transparent-scaled.jpg' srcset='https://www.odiware.com/wp-content/uploads/2020/04/color_logo_transparent-scaled.jpg 1x, https://www.odiware.com/wp-content/uploads/2020/04/color_logo_transparent-scaled.jpg 2x' alt='Odiware Technologies' class='logo logoDefault' />
|
|
|
|
// <h3 style='color:green'>API Gateway (Online Assessment)</h3>
|
|
// <ul style='list-style-type:none;'>
|
|
// <li>
|
|
// User API <a href='http://api-user.odiprojects.com/swagger/index.html' target='_blank'>(api-user)</a>
|
|
// </li>
|
|
// <li style='height: 20px'> </li>
|
|
// <li>
|
|
// Admin API <a href='http://api-admin.odiprojects.com/swagger/index.html' target='_blank'>(api-admin)</a>
|
|
// </li>
|
|
// <li style='height: 20px'> </li>
|
|
// <li>
|
|
// Institute API <a href='http://api-institute.odiprojects.com/swagger/index.html' target='_blank'>(api-institute)</a>
|
|
// </li>
|
|
// <li style='height: 20px'> </li>
|
|
// <li>
|
|
// Student API <a href='http://api-student.odiprojects.com/swagger/index.html' target='_blank'>(api-institute)</a>
|
|
// </li>
|
|
// <li style='height: 20px'> </li>
|
|
// <li>
|
|
// Images API <a href='http://api-bucket.odiprojects.com/swagger/index.html' target='_blank'>(api-institute)</a>
|
|
// </li>
|
|
|
|
// </ul>
|
|
// </div>
|
|
// ";
|
|
//return indexPage;
|
|
}
|
|
}
|
|
}
|