.NET 6에서 GraphQL 시작하기 - 4부(추가 - Azure 웹 앱에 배포)

이번 포스팅은 마지막 부분이 될 것입니다. Azure Web App(백엔드용) 및 Azure Static Web App(프론트엔드용)에 배포하는 방법에 대한 비디오를 제공합니다. 더 많은 관심을 기울여야 할 몇 가지 참고 사항을 알려 드리겠습니다.

동영상





메모



BE 코드


  • 아직 Azure에서 SQL Server를 배포하고 싶지 않기 때문에 EF In Memory를 설치합니다. 이 시리즈가 아닌 단일 기사에 게시할 계획이 있습니다.

  • <ItemGroup>
        <!-- other dependencies... -->
        <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0" />
        <!-- other codes ... -->
    </ItemGroup>
    


  • 메모리에서 사용하도록 Program.cs를 업데이트합니다.

  • // Add services to the container.
    builder.Services.AddDbContext<NotesContext>(options =>
    {
        // options.UseSqlServer(builder.Configuration.GetConnectionString("Default"));
        options.UseInMemoryDatabase("NotesTest");
    });
    


    FE 코드


  • index.tsx에서 백엔드(GraphQL) URL을 업데이트합니다. 하드 코딩 대신 환경을 사용하도록 업데이트할 수 있으므로 빌드 단계에서 URL을 설정할 수 있습니다.

  • // other codes
    
    const client = new ApolloClient({
      uri: 'https://graph-api-demo.azurewebsites.net/graphql',
      cache: new InMemoryCache()
    });
    
    // other codes
    


    고맙습니다



    좋은 웹페이지 즐겨찾기