@rip-lang/api 0.5.0 → 0.5.2
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/api.rip +7 -0
- package/package.json +1 -1
package/api.rip
CHANGED
|
@@ -301,6 +301,13 @@ export startHandler = -> fetch
|
|
|
301
301
|
|
|
302
302
|
export start = (opts = {}) ->
|
|
303
303
|
handler = startHandler()
|
|
304
|
+
|
|
305
|
+
# If running under rip-server, set global handler and return
|
|
306
|
+
if process.env.WORKER_ID? or process.env.SOCKET_PATH?
|
|
307
|
+
globalThis.__ripHandler = handler
|
|
308
|
+
return handler
|
|
309
|
+
|
|
310
|
+
# Otherwise start standalone server
|
|
304
311
|
host = opts.host or '0.0.0.0'
|
|
305
312
|
port = opts.port or 3000
|
|
306
313
|
server = Bun.serve { hostname: host, port: port, fetch: handler }
|