---
title: "JSSアプリをJSSサイトにインポートしてください"
slug: "import-a-jss-app-into-your-jss-site"
abstract: ""
---
# JSSアプリをJSSサイトにインポートしてください

JSSアプリケーションをSXA環境にデプロイする場合、一般的なアプリケーション展開プロセスとはいくつか違いがあります。サイト作成JSS、デフォルトの設定は項目(Site/Settings/)で追加されるため、前述の一般的なプロセスの構成展開ステップをスキップしなければなりません[jss.sitecore.com](https://jss.sitecore.com/docs/getting-started/app-deployment)。

JSSアプリをJSSサイトにインポートするには:

1.  JSSアプリをインポートする前に、[jss.sitecore.com](http://jss.sitecore.com)で説明されている手順に従い、アプリのサイト名やホスト名の設定を必ず行ってください。
    
2.  APIキーを作成し、そのアイテムIDをアプリ設定時に記録してください。
    
3.  レイアウトサービスが動作しているかをテストするには、Sitecoreホストのレイアウトサービスにテストリクエストを行ってください。 http://myapp.siteco.re/sitecore/api/layout/render/jss?item=/&amp;sc\_apikey={YOUR\_API\_KEY\_ID}
    
4.  Sitecore接続を設定するには、JSSアプリのコマンドラインでjss setupを実行し、指示に従ってください。いくつかの情報を求められます。
    
    -   Sitecoreフォルダへのパス:先ほど作成したJSSサイトへのパスを入力します。例えば: C:\\inetpub\\wwwroot\\sxa92。
        
    -   ホスト名:SXAサイトのホスト名を入力してください。例えば: http://sxa92。
        
    -   インポートサービスURL:デフォルト設定を変更する必要はありません。例えば、http://sxa92/sitecore/api/jss/importのままにしてください。
        
    -   APIキー:APIキーのGUIDを入力します。
        
    -   デプロイメントシークレット:ここにシークレットを入力するか、エンターキーを押して作成してください。新しいデプロイシークレットを作成する場合は、コンテンツエディター(JSS site/Settings)で入力する必要があります。
        
        ![JSS Deployment secret](https://doc.sitecore.com/api/markdown-image/xp/ja/developers/sxa/93/sitecore-experience-accelerator/images/SXA-deployment-secret.png)
        
    
    > !重要JSS上でSXA展開を行っているため、設定展開のステップを省略できます。
    
5.  ウェブアプリケーションでGraphQLを使いたい場合は、GraphQlエンドポイントの設定を設定ファイルにデプロイし、\\Website\\App\_Config\\Include\\zzzに配置する必要があります。以下の例パッチを利用できます。URLとテンプレートパスは必ず更新してください。
    
    <!--
     JSS Sitecore Configuration Patch File
    
     This configuration file registers the JSS site with Sitecore, and configures the Layout Service
     to work with it. Config patches need to be deployed to the Sitecore server.
    
     Normally \`jss deploy config\` can do this for local development. To manually deploy, or to deploy via CI,
     this file can be placed in the \`App\_Config/Include\` folder, or a subfolder of it, within the Sitecore site.
    -->
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
     <sitecore>
     <api>
     <!--
     Define the app's Sitecore GraphQL API endpoint
     Note: this can be removed if you are not using GraphQL.
     Note: the endpoint must be defined both for integrated and connected type GraphQL queries.
     -->
     <GraphQL>
     <endpoints>
     <carsGraphQLEndpoint url="/api/cars" type="Sitecore.Services.GraphQL.Hosting.DatabaseAwareGraphQLEndpoint, Sitecore.Services.GraphQL.NetFxHost" resolve="true">
     <url>$(url)</url>
    
     <enabled>true</enabled>
     <enableSubscriptions>true</enableSubscriptions>
    
     <!-- lock down the endpoint when deployed to content delivery -->
     <graphiql role:require="ContentDelivery">false</graphiql>
     <enableSchemaExport role:require="ContentDelivery">false</enableSchemaExport>
     <enableStats role:require="ContentDelivery">false</enableStats>
     <enableCacheStats role:require="ContentDelivery">false</enableCacheStats>
     <disableIntrospection role:require="ContentDelivery">true</disableIntrospection>
    
     <schema hint="list:AddSchemaProvider">
     <content type="Sitecore.Services.GraphQL.Content.ContentSchemaProvider, Sitecore.Services.GraphQL.Content">
     <!-- scope typed template generation to just this app's templates -->
     <templates type="Sitecore.Services.GraphQL.Content.TemplateGeneration.Filters.StandardTemplatePredicate, Sitecore.Services.GraphQL.Content">
     <database>context</database>
     <paths hint="list:AddIncludedPath">
     <templates>/sitecore/templates/Project/Demo</templates>
     </paths>
     <fieldFilter type="Sitecore.Services.GraphQL.Content.TemplateGeneration.Filters.StandardFieldFilter, Sitecore.Services.GraphQL.Content">
     <exclusions hint="raw:AddFilter">
     <!--
     Remove system fields from the API (e.g. \_\_Layout) to keep the schema lean
     -->
     <exclude name="\_\_\*" />
     </exclusions>
     </fieldFilter>
     </templates>
    
     <queries hint="raw:AddQuery">
     <!-- enable querying on items via this API -->
     <query name="item" type="Sitecore.Services.GraphQL.Content.Queries.ItemQuery, Sitecore.Services.GraphQL.Content" />
     </queries>
    
     <fieldTypeMapping ref="/sitecore/api/GraphQL/defaults/content/fieldTypeMappings/standardTypeMapping" />
     </content>
     </schema>
    
     <!-- Enables the 'jss' graph nodes that are preformatted to use with JSS rendering components, and the datasource resolving queries for JSS -->
     <extenders hint="list:AddExtender">
     <layoutExtender type="Sitecore.JavaScriptServices.GraphQL.JssExtender, Sitecore.JavaScriptServices.GraphQL" resolve="true" />
     </extenders>
    
     <!-- Determines the security of the service. 'publicService' is open to anonymous access, but requires an SSC API key. -->
     <security ref="/sitecore/api/GraphQL/defaults/security/publicService" />
    
     <!-- Determines how performance is logged for the service. Defaults are defined in Sitecore.Services.GraphQL.config -->
     <performance ref="/sitecore/api/GraphQL/defaults/performance/standard" />
     </carsGraphQLEndpoint>
     </endpoints>
     </GraphQL>
     </api>
     </sitecore>
    </configuration>
    
6.  アプリをインポートするには、JSSアプリ内のコマンドプロンプトやターミナルを開き、以下を実行します:
    
    jss deploy app --includeContent --includeDictionary