mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
21 lines
471 B
TypeScript
21 lines
471 B
TypeScript
import http from 'node:http'
|
|
export function createSimpleRemoteIslandProvider (port = 3001) {
|
|
const server = http.createServer((req, res) => {
|
|
const response = {
|
|
html: '<div>hello world from another server</div>',
|
|
state: {},
|
|
head: {
|
|
link: [],
|
|
style: []
|
|
}
|
|
}
|
|
res.statusCode = 200
|
|
res.setHeader('Content-Type', 'application/json')
|
|
res.end(JSON.stringify(response))
|
|
})
|
|
|
|
server.listen(port)
|
|
|
|
return server
|
|
}
|