16 lines
402 B
TypeScript
16 lines
402 B
TypeScript
import { startServer, handler } from './dist/server/entry.mjs'
|
|
|
|
import { createServer } from 'node:http'
|
|
// startServer( )
|
|
|
|
const server = createServer((req, res) => {
|
|
// 设置跨域的响应头
|
|
handler(req, res);
|
|
})
|
|
// server.listen(8000)
|
|
|
|
|
|
server.listen('./app.sock', () => {
|
|
console.log('Server is listening on ./app.sock')
|
|
// curl -X GET --unix-socket ./app.sock http://localhost/hello
|
|
})
|