diff --git a/website/src/code-examples/api-reference/application-config/runtime-application-environment.tsx b/website/src/code-examples/api-reference/application-config/runtime-application-environment.tsx index 5726c86d49..599ce6ee21 100644 --- a/website/src/code-examples/api-reference/application-config/runtime-application-environment.tsx +++ b/website/src/code-examples/api-reference/application-config/runtime-application-environment.tsx @@ -1,8 +1,6 @@ -import type { TApplicationContext } from '@commercetools-frontend/application-shell-connectors'; +import type { ApplicationWindow } from '@commercetools-frontend/constants'; -declare const window: typeof Window & { - app: TApplicationContext<{}>['environment']; -}; +declare let window: ApplicationWindow; const EntryPoint = () => ( { + res.send('It works 🙌'); +}); + +app.listen(6000, () => { + console.log('Running on port 6000.'); +}); + +module.exports = app; diff --git a/website/src/code-examples/concepts/integrate-with-your-own-api/local-development.ts b/website/src/code-examples/concepts/integrate-with-your-own-api/local-development.ts new file mode 100644 index 0000000000..0022d5e2e9 --- /dev/null +++ b/website/src/code-examples/concepts/integrate-with-your-own-api/local-development.ts @@ -0,0 +1,22 @@ +import express, { type Request, type Response } from 'express'; +import { + createSessionMiddleware, + CLOUD_IDENTIFIERS, +} from '@commercetools-backend/express'; + +const app = express(); +app.use( + createSessionMiddleware({ + audience: 'https://33ea-87-183-162-9.eu.ngrok.io', + issuer: CLOUD_IDENTIFIERS.GCP_EU, + }) +); +app.post('/echo', (_req: Request, res: Response) => { + res.send('It works 🙌'); +}); + +app.listen(6000, () => { + console.log('Running on port 6000.'); +}); + +export default app; diff --git a/website/src/code-examples/help-needed/entry-point-uri-path.ts b/website/src/code-examples/help-needed/entry-point-uri-path.ts index 6a48c1cc0e..2c27ffff7a 100644 --- a/website/src/code-examples/help-needed/entry-point-uri-path.ts +++ b/website/src/code-examples/help-needed/entry-point-uri-path.ts @@ -1,10 +1,8 @@ // Make sure to import the helper functions from the `ssr` entry point. import { entryPointUriPathToPermissionKeys } from '@commercetools-frontend/application-shell/ssr'; -import type { TApplicationContext } from '@commercetools-frontend/application-shell-connectors'; +import type { ApplicationWindow } from '@commercetools-frontend/constants'; -declare const window: typeof Window & { - app: TApplicationContext<{}>['environment']; -}; +declare let window: ApplicationWindow; export const entryPointUriPath = typeof window === 'undefined' diff --git a/website/src/content/concepts/integrate-with-your-own-api.mdx b/website/src/content/concepts/integrate-with-your-own-api.mdx index e94462dc02..96b1d0a235 100644 --- a/website/src/content/concepts/integrate-with-your-own-api.mdx +++ b/website/src/content/concepts/integrate-with-your-own-api.mdx @@ -220,30 +220,10 @@ The URL `https://.ngrok.io` can now be used as the URL of the server This is also the value of the `audience` to be configured in your session middleware when using the `@commercetools-backend/express` package. -```js highlightLines="10" -const express = require("express"); -const { - createSessionMiddleware, - CLOUD_IDENTIFIERS, -} = require("@commercetools-backend/express"); - -const app = express(); -app.use( - createSessionMiddleware({ - audience: "https://33ea-87-183-162-9.eu.ngrok.io", - issuer: CLOUD_IDENTIFIERS.GCP_EU, - }) -); -app.post("/echo", (req, res) => { - res.send("It works 🙌"); -}); - -app.listen(6000, () => { - console.log("Running on port 6000."); -}); - -module.exports = app; -``` + + + + We recommend configuring the external API URL using environment variables to be able to define different values for development (using a secure tunnel) and production. In the Custom Application config you can specify the external API URL as an [`additionalEnv`](/api-reference/application-config#additionalenv) property using a [variable placeholder](/api-reference/application-config#using-variable-placeholders). diff --git a/website/src/content/help-needed.mdx b/website/src/content/help-needed.mdx index db4489ff36..8bd0d4e279 100644 --- a/website/src/content/help-needed.mdx +++ b/website/src/content/help-needed.mdx @@ -116,6 +116,6 @@ Therefore, both server-side and client-side logic must be considered when readin - +