instaserve 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module.mjs +3 -3
- package/package.json +1 -1
- package/server.mjs +1 -1
package/module.mjs
CHANGED
|
@@ -11,7 +11,7 @@ function public_file(r, s) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export default function (routes, port = 3000) {
|
|
14
|
+
export default function (routes, port = 3000, ip = '127.0.0.1') {
|
|
15
15
|
const server = http.createServer(async (r, s) => {
|
|
16
16
|
let data = ''
|
|
17
17
|
r.on('data', (s) => data += s.toString().trim())
|
|
@@ -40,9 +40,9 @@ export default function (routes, port = 3000) {
|
|
|
40
40
|
s.writeHead(404).end(err)
|
|
41
41
|
}
|
|
42
42
|
})
|
|
43
|
-
}).listen(process.env.port || port)
|
|
43
|
+
}).listen(process.env.port || port, process.env.ip || ip)
|
|
44
44
|
|
|
45
|
-
console.log(
|
|
45
|
+
console.log(`started on: ${(process.env.ip || ip)}:${(process.env.port || port)}, using routes: ${Object.keys(routes)}`)
|
|
46
46
|
|
|
47
47
|
return {
|
|
48
48
|
routes: routes,
|
package/package.json
CHANGED
package/server.mjs
CHANGED