클리엘
CLIEL LAB
클리엘
전체 방문자
오늘
어제
  • 분류 전체보기 (514)
    • Mobile (47)
      • Kotlin (47)
    • Web (84)
      • NestJS (9)
      • HTML5 & CSS3 (38)
      • Javascript (20)
      • TypeScript (6)
      • JQuery (11)
    • .NET (301)
      • C# (84)
      • ASP.NET (67)
      • Windows API for .NET (128)
    • Server (53)
      • SQL Server (10)
      • MariaDB (18)
      • Windows Server (6)
      • node.js (19)
    • System (12)
      • 작업LOG (12)
    • Review (11)
    • ETC (6)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

  • 블로그 정리

인기 글

태그

  • .NET
  • android studio
  • asp.net core
  • Windows API
  • exception
  • Entity Framework
  • HTML5
  • asp.net core web api
  • JavaScript
  • LINQ
  • Kotlin
  • CSS3
  • 변수
  • android
  • jQuery
  • ASP.NET
  • MariaDB
  • c#
  • node.js
  • NestJS

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
클리엘

CLIEL LAB

[ASP.NET Core] ASP.NET Core API에 ReactJS 배포하기
.NET/ASP.NET

[ASP.NET Core] ASP.NET Core API에 ReactJS 배포하기

2021. 6. 1. 16:47
728x90

1. NuGet Package에서 Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer를 찾아 설치합니다.

 

2. Project의 Startup.cs파일에서 다음과 같은 코드를 추가하여 정적 파일 서비스를 등록하고 사용할 수 있도록 설정합니다.

 

--ConfigureServices

services.AddSpaStaticFiles(configuration =>
{
    configuration.RootPath = "ClientApp/build";
});

--Configure

app.UseDefaultFiles();
app.UseStaticFiles();
app.UseSpaStaticFiles();
.
.
.
.
app.UseSpa(spa =>
{
    spa.Options.SourcePath = "ClientApp";

    if (env.IsDevelopment())
    {
        spa.UseReactDevelopmentServer(npmScript: "start");
    }
});

3. 설정에 따라 프로젝트의 Root에 ClientApp/build 폴더를 생성하고 빌드된 ReactJS파일들을 이곳에 생성하도록 합니다.

728x90
저작자표시 비영리 변경금지 (새창열림)

'.NET > ASP.NET' 카테고리의 다른 글

[ASP.NET Core] Microsoft.Data.SqlClient.SqlException (0x80131904)  (0) 2021.08.03
[ASP.NET Core Web API] Swagger에 JWT인증 적용하기  (0) 2021.06.15
[ASP.NET Core] MailKit 사용  (0) 2021.05.28
[ASP.NET Core Web API] 'IAsyncEnumerable Reader' reached the configured maximum size of the buffer when enumerating a value of type  (0) 2021.03.30
[ASP.NET Core] IIS 호스팅  (0) 2021.03.30
    '.NET/ASP.NET' 카테고리의 다른 글
    • [ASP.NET Core] Microsoft.Data.SqlClient.SqlException (0x80131904)
    • [ASP.NET Core Web API] Swagger에 JWT인증 적용하기
    • [ASP.NET Core] MailKit 사용
    • [ASP.NET Core Web API] 'IAsyncEnumerable Reader' reached the configured maximum size of the buffer when enumerating a value of type
    클리엘
    클리엘
    누구냐 넌?

    티스토리툴바