Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ASP.NET Base for service
- .ASP.NET 5.0
- Author - aws (qwark)
- */
- using Microsoft.AspNetCore;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Hosting;
- using Microsoft.Extensions.Logging;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Text.Json;
- using System.Text.Json.Serialization;
- string ToJson(object obj)
- {
- return JsonSerializer.Serialize(obj);
- }
- WebHost.CreateDefaultBuilder()
- .Configure(x =>
- {
- x.Map("/api", z => z.Run((context) =>
- {
- return context.Response.WriteAsync($"Hello. Its root page of service\n" +
- $"Request query: {ToJson(context.Request.Query)}\n");
- }));
- x.Map("", z => z.Run((context) =>
- {
- return context.Response.WriteAsync("aws service\nUse /api for more info...");
- }));
- })
- .UseUrls("http://localhost:1010")
- .Build().Run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement