You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Serialization;
|
|
using ZKLT.Hadoop;
|
|
namespace ZKLT.Hadoop.API
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddControllers().AddNewtonsoftJson(options =>
|
|
{
|
|
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
|
|
|
options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
|
|
|
|
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
|
});
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
builder.Services.AddHadoop();
|
|
var app = builder.Build();
|
|
app.UseHadoop((c) => {
|
|
c.Host = "127.0.0.1";
|
|
c.Account = "root";
|
|
c.PassWord = "root";
|
|
c.Key = "devdb";
|
|
c.Port = 3306;
|
|
});
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|
|
}
|
|
}
|
|
}
|