API - startSourceServer
Publish a Source or or a Protected Source over HTTP and WebSockets.
import startSourceServer from '@aven-cloud/cloud-server/startSourceServer';
const source = await start*Source(...)
await startSourceServer({
source,
listenLocation: 8888
});
// Source is now hosted on localhost:8888
});
The source server provides no security. If you want to put this on the public internet, it is reccomended to use a protected source
HTTPS is not currently supported within the server, but you can use nginx or something to accomplish that, proxying this server.
API
source - the Source or Protected Source to publish
listenLocation - the port or Unix socket to serve HTTPS+WS
expressRouting(app) - a callback to add routes
fallbackExpressRouting(app) -
quiet
Example with a web app
import
const server = await startSourceServer({
source,
listenLocation: serverListenLocation,
expressRouting: doExpressRouting,
fallbackExpressRouting: doFallbackExpressRouting,
});
startSourceServer({
source,
listenLocation,
expressRouting = undefined,
fallbackExpressRouting = undefined,
quiet = false,
})
});