-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (23 loc) · 828 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module.exports = ({ include, write, redirect, session }) => {
if (!session.email) {
return redirect("/login.js");
}
include("header.js");
write(`
<h2>Hello World!</h2>
You are logged in as ${session.email}.
<div>
<b>Check out this cool React counter:</b>
<span id="counter"></span>
</div>
<p><a href="/logout.js">Logout</a></p>
<script src="https://unpkg.com/react@16/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="/static/counter.js" type="text/babel"></script>
<script type="text/babel">
ReactDOM.render(<Counter />, document.getElementById("counter"));
</script>
`);
include("footer.js");
};