2023-10-05 06:15:44 -04:00
|
|
|
const { readFile } = require('fs/promises')
|
|
|
|
const { Server } = require('http')
|
|
|
|
|
|
|
|
async function main() {
|
|
|
|
const webPage = await readFile('index.html', { encoding: 'utf-8' })
|
2023-10-05 07:29:48 -04:00
|
|
|
const pfp = await readFile('pfp.png')
|
|
|
|
const favicon = await readFile('favicon.ico')
|
2023-10-05 06:15:44 -04:00
|
|
|
const server = new Server(
|
2023-10-05 07:29:48 -04:00
|
|
|
(req, res) => {
|
|
|
|
if (req.url === '/pfp.png')
|
2023-10-05 07:36:16 -04:00
|
|
|
res.writeHead(200, { 'Content-Type': 'image/png' })
|
2023-10-05 07:29:48 -04:00
|
|
|
.end(pfp)
|
|
|
|
else if (req.url === '/favicon.ico')
|
2023-10-05 07:36:16 -04:00
|
|
|
res.writeHead(200, { 'Content-Type': 'image/vnd.microsoft.icon' })
|
2023-10-05 07:29:48 -04:00
|
|
|
.end(favicon)
|
|
|
|
else
|
|
|
|
res.writeHead(200, { 'Content-Type': 'text/html' })
|
|
|
|
.end(webPage)
|
|
|
|
}
|
2023-10-05 06:15:44 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
server.listen(1312, () => {
|
|
|
|
console.log('listening on 0.0.0.0:1312')
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|