<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## CORS 跨源資源共享(`CORS`)是一種允許從另一個域請求資源的機制。在底層,`Nest` 使用了Express的[cors](https://github.com/expressjs/cors) 包,它提供了一系列選項,您可以根據自己的要求進行自定義。 ### 開始 為了啟用 `CORS`,必須調用 `enableCors()` 方法。 ```typescript const app = await NestFactory.create(AppModule); app.enableCors(); await app.listen(3000); ``` 該`enableCors()`方法需要一個可選的配置對象參數。這個對象的可用屬性在官方 <a href="https://github.com/expressjs/cors#configuration-options" style="color:red;">CORS</a> 文檔中有所描述。另一種方法是傳遞一個<a href="https://github.com/expressjs/cors#configuring-cors-asynchronously" style="color:red;">回調函數</a>,來讓你根據請求異步地定義配置對象。 或者通過 `create()` 方法的選項對象啟用CORS。將 `cors`屬性設置為`true`,以使用默認設置啟用CORS。又或者,傳遞一個 <a href="https://github.com/expressjs/cors#configuration-options" style="color:red;">CORS 配置對象</a> 或 <a href="https://github.com/expressjs/cors#configuring-cors-asynchronously" style="color:red;">回調函數</a> 作為 `cors` 屬性的值來自定義其行為。 ```typescript const app = await NestFactory.create(AppModule, { cors: true }); await app.listen(3000); ``` 上述方法僅適用于 REST 端點。 要在 `GraphQL` 中啟用 `CORS`,請將 `cors` 屬性設置為 `true` 或在導入 `GraphQL` 模塊時將 `CORS` 配置對象或回調函數作為 `cors` 屬性值傳遞。 >**提醒**:CorsOptionsDelegate 解決方案尚不能與 apollo-server-fastify 包一起使用。 ~~~typescript GraphQLModule.forRoot({ cors: { origin: 'http://localhost:3000', credentials: true, }, }), ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看