kill-the-newsletter/src/server.tsx

23 lines
437 B
TypeScript
Raw Normal View History

2020-03-18 04:07:48 +01:00
import express from "express";
import React from "react";
import ReactDOMServer from "react-dom/server";
2020-03-18 05:49:41 +01:00
import { Layout, Form } from "./components";
2020-03-18 04:07:48 +01:00
const app = express();
2020-03-18 15:14:00 +01:00
const doctype = `<!DOCTYPE html>\n`;
2020-03-18 04:07:48 +01:00
app.use(express.static("static"));
app.get("/", (req, res) =>
2020-03-18 05:49:41 +01:00
res.send(
2020-03-18 15:14:00 +01:00
doctype +
ReactDOMServer.renderToStaticMarkup(
<Layout>
<Form></Form>
</Layout>
)
2020-03-18 05:49:41 +01:00
)
2020-03-18 04:07:48 +01:00
);
app.listen(4000);