-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal.ts
More file actions
33 lines (28 loc) · 761 Bytes
/
local.ts
File metadata and controls
33 lines (28 loc) · 761 Bytes
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
// @ts-nocheck
import * as app from './'
// console.log(app.play({}, {}))
// const mod = require('./')
// mod.pageHandler({}, {}, console.log)
const http = require('http')
const host = 'localhost'
const port = 8000
const requestListener = async (req, res) => {
// console.log(req)
res.writeHead(200)
if (req.method === 'GET') {
const lambdaEvent = {
rawPath: req.url
}
const response = await app.pageHandler(lambdaEvent)
console.log(lambdaEvent)
res.end(response.body)
// return
} else if (req.method === 'POST') {
// game api
}
// res.end('My first server!')
}
const server = http.createServer(requestListener)
server.listen(port, host, () => {
console.log(`Server is running on http://${host}:${port}`)
})