A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://gist.github.com/developit/699c8d8f180a1e4eed58167f9c6711be below:

htm-ssr.js · GitHub

Created September 5, 2019 00:30

Clone this repository at <script src="https://gist.github.com/developit/699c8d8f180a1e4eed58167f9c6711be.js"></script>

Save developit/699c8d8f180a1e4eed58167f9c6711be to your computer and use it in GitHub Desktop.

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 const express = require('express'); const { html, Component } = require('htm/preact'); const renderToString = require('preact-render-to-string'); class App extends Component { render(props) { return html` <div class="app"> <h1>This is an app</h1> <p>Current server time: ${new Date + ''}</p> </div> `; } } const app = express(); app.get('/', (request, response) => { // render your app to an HTML string const body = renderToString(html`<${App} url=${request.url} />`); // wrap it in an HTML document and send it back response.send(`<!DOCTYPE html><html><body>${body}</body></html>`); }); 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 { "dependencies": { "htm": "^2.2.1", "preact": "^8.5.2", "express": "^4.17.1" } }

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4