💧SSR / SSG
Implement SSR and SST without friction
Node
// If your version of node accepts top-level await just point to 'atomico/ssr'
import 'atomico/ssr/load';
import { html } from 'atomico';
import { Component } from './static/component.js';
import express from 'express';
const app = express();
const port = 3010;
app.use(express.static('static'));
app.get('/', (req, res) => {
res.send(`
<script type="importmap">
{
"imports": {
"atomico": "https://unpkg.com/atomico"
}
}
</script>
<script src="./component.js" type="module"></script>
${html`<${Component} value=${100}>
<h1>Message from server!</h1>
</${Component}>`.render()}
`);
});
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});
SSR/SSG via @atomico/react
Astro build
Last updated
Was this helpful?
