This file contains 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 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); | |
} |
This file contains 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
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) { |