This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { serve } from "https://deno.land/std@0.114.0/http/server.ts"; | |
| import { DOMParser } from "https://esm.sh/linkedom"; | |
| async function handler(req: Request): Promise<Response> { | |
| const document = new DOMParser().parseFromString(`<html> | |
| <head><title>Just a simple page</title></head> | |
| <body> | |
| <h1>This header will change</h1> | |
| <p>The above header will change depending on the flag value.</p> | |
| </body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { getAssetFromKV } from "@cloudflare/kv-asset-handler"; | |
| const { init } = require("launchdarkly-cloudflare-edge-sdk"); | |
| let ldClient; | |
| class FlagsStateInjector { | |
| async element(element) { | |
| // fetch all flag values for client-side SDKs as evaluated for an anonymous user | |
| // use a more appropriate user key if needed | |
| const user = { | |
| key: "anonymous", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { AppProps } from 'next/app' | |
| import '../styles/index.css' | |
| import { withLDProvider } from "launchdarkly-react-client-sdk"; | |
| function MyApp({ Component, pageProps }: AppProps) { | |
| return <Component {...pageProps} /> | |
| } | |
| export default withLDProvider({ | |
| clientSideID: process.env.LAUNCHDARKLY_SDK_CLIENT!, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { AppProps } from 'next/app' | |
| import '../styles/index.css' | |
| function MyApp({ Component, pageProps }: AppProps) { | |
| return <Component {...pageProps} /> | |
| } | |
| export default withLDProvider({ | |
| clientSideID: process.env.LAUNCHDARKLY_SDK_CLIENT, | |
| })(MyApp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { AppProps } from 'next/app' | |
| import '../styles/index.css' | |
| export default function MyApp({ Component, pageProps }: AppProps) { | |
| return <Component {...pageProps} /> | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as LaunchDarkly from "launchdarkly-node-server-sdk"; | |
| import * as dotenv from "dotenv"; | |
| dotenv.config({ path: __dirname + "/.env" }); | |
| let ldClient: LaunchDarkly.LDClient; | |
| async function getClient(): Promise<LaunchDarkly.LDClient> { | |
| const client = LaunchDarkly.init(process.env.LAUNCHDARKLY_SDK_KEY); | |
| await client.waitForInitialization(); | |
| return client; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = require("request"), | |
| cheerio = require("cheerio"), | |
| ProgressBar = require('progress'), | |
| Knwl = require("knwl.js"), | |
| apiURL = "http://jamesbond.wikia.com/api/v1/Articles/List?category=James_Bond_films&limit=50", | |
| baseURL = "http://jamesbond.wikia.com"; | |
| console.log("Target: James Bond"); | |
| // get the full list of movies from the API | |
| request(apiURL, function (error, response, body) { |