-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.tsx
37 lines (35 loc) · 931 Bytes
/
server.tsx
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
31
32
33
34
35
36
37
import { Elysia } from 'elysia';
import { html } from '@elysiajs/html';
import { trailingSlashPlugin } from './plugins/trailingSlashPlugin';
import staticPlugin from './plugins/staticPlugin';
import { otpHandler } from './otpRoutes';
import { RootLayout } from './templates';
new Elysia()
.use(
staticPlugin({
assets: 'public',
prefix: '/public',
})
)
.use(
staticPlugin({
assets: 'node_modules',
prefix: '/node_modules',
alwaysStatic: false,
ignorePatterns: [/@romanzy/],
})
)
.use(trailingSlashPlugin)
.use(html())
.get('/', () => (
<RootLayout title="@romanzy/otp example">
<h1>@romanzy/otp and htmx example</h1>
<div>
To see how login is done go to <a href="/otp/">test page</a>
</div>
</RootLayout>
))
.use(otpHandler)
.listen(8080, (server) => {
console.log(`Listening on http://localhost:${server.port}`);
});