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 { renderToStaticMarkup } from 'react-dom/server'; | |
import { type ComponentType } from 'react'; | |
/** | |
* Converts a specified React component to its HTML string representation. | |
* @param Component A React component to be rendered, for instance, `AccountSignInEmail`. | |
* @param props An object containing the props to be passed to the Component. Type safety is enforced. | |
* @returns The HTML string representation of the rendered component. | |
*/ | |
export const render = <P extends object>(Component: ComponentType<P>, props: P): string => |
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
interface Env { | |
DATABASE: D1Database; | |
} | |
export default { | |
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> { | |
const tables = await env.DATABASE.prepare( | |
"SELECT tbl_name, sql FROM sqlite_master WHERE type='table' AND tbl_name NOT LIKE '_cf_KV' AND tbl_name NOT LIKE 'sqlite_stat1';" | |
) | |
.all() |