This commit is contained in:
parent
4e49678250
commit
8bedda75d8
|
@ -13,12 +13,10 @@ import {
|
||||||
} from "./components";
|
} from "./components";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
const webApp = express();
|
export const webServer = express()
|
||||||
|
.use(express.static("static"))
|
||||||
webApp.use(express.static("static"));
|
.use(express.urlencoded({ extended: true }))
|
||||||
webApp.use(express.urlencoded({ extended: true }));
|
.get("/", (req, res) =>
|
||||||
|
|
||||||
webApp.get("/", (req, res) =>
|
|
||||||
res.send(
|
res.send(
|
||||||
renderHtml(
|
renderHtml(
|
||||||
<Layout>
|
<Layout>
|
||||||
|
@ -26,9 +24,8 @@ webApp.get("/", (req, res) =>
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
|
.post("/", (req, res) => {
|
||||||
webApp.post("/", (req, res) => {
|
|
||||||
const inbox: Inbox = { name: req.body.name, token: newToken() };
|
const inbox: Inbox = { name: req.body.name, token: newToken() };
|
||||||
fs.writeFileSync(feedPath(inbox.token), renderXml(Feed(inbox)));
|
fs.writeFileSync(feedPath(inbox.token), renderXml(Feed(inbox)));
|
||||||
res.send(
|
res.send(
|
||||||
|
@ -38,6 +35,5 @@ webApp.post("/", (req, res) => {
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
})
|
||||||
|
.listen(8443);
|
||||||
export const webServer = webApp.listen(8443);
|
|
||||||
|
|
Loading…
Reference in New Issue