]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | // Licensed to the Apache Software Foundation (ASF) under one or more |
2 | // contributor license agreements. See the NOTICE file distributed with | |
3 | // this work for additional information regarding copyright ownership. | |
4 | // The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 | // (the "License"); you may not use this file except in compliance with | |
6 | // the License. You may obtain a copy of the License at | |
7 | // | |
8 | // http://www.apache.org/licenses/LICENSE-2.0 | |
9 | // | |
10 | // Unless required by applicable law or agreed to in writing, software | |
11 | // distributed under the License is distributed on an "AS IS" BASIS, | |
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | // See the License for the specific language governing permissions and | |
14 | // limitations under the License. | |
15 | ||
16 | using System; | |
17 | using System.Collections.Generic; | |
18 | using System.Linq; | |
19 | using System.Threading.Tasks; | |
20 | using Microsoft.AspNetCore.Builder; | |
21 | using Microsoft.AspNetCore.Hosting; | |
22 | using Microsoft.AspNetCore.Http; | |
23 | using Microsoft.Extensions.DependencyInjection; | |
24 | using Microsoft.Extensions.Hosting; | |
25 | ||
26 | namespace Apache.Arrow.Flight.TestWeb | |
27 | { | |
28 | public class Startup | |
29 | { | |
30 | // This method gets called by the runtime. Use this method to add services to the container. | |
31 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 | |
32 | public void ConfigureServices(IServiceCollection services) | |
33 | { | |
34 | services.AddGrpc() | |
35 | .AddFlightServer<TestFlightServer>(); | |
36 | ||
37 | services.AddSingleton(new FlightStore()); | |
38 | } | |
39 | ||
40 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | |
41 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
42 | { | |
43 | if (env.IsDevelopment()) | |
44 | { | |
45 | app.UseDeveloperExceptionPage(); | |
46 | } | |
47 | ||
48 | app.UseRouting(); | |
49 | ||
50 | app.UseEndpoints(endpoints => | |
51 | { | |
52 | endpoints.MapFlightEndpoint(); | |
53 | ||
54 | endpoints.MapGet("/", async context => | |
55 | { | |
56 | await context.Response.WriteAsync("Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909"); | |
57 | }); | |
58 | }); | |
59 | } | |
60 | } | |
61 | } |