Skip to content

Instantly share code, notes, and snippets.

View saadq's full-sized avatar

Saad Quadri saadq

View GitHub Profile
import React from 'https://cdn.skypack.dev/react?dts';
import * as ReactDOMServer from 'https://cdn.skypack.dev/react-dom/server?dts';
import { serve } from 'https://deno.land/std@0.117.0/http/server.ts';
function requestHandler(req: Request) {
const App = () => <h1>Hello</h1>;
const html = ReactDOMServer.renderToString(<App />);
return new Response(html);
}
const { PassThrough } = require('stream');
// This creates a read/write stream and returns it to the user.
// If an error is thrown, the error should be emitted to the output stream.
function getStream() {
const outputStream = new PassThrough();
try {
doSomething();
} catch (error) {