Configuring universal-fs
Usage without Ngrok

Usage without Ngrok

As of universal-fs v1.1.0 you can use your own server with your own custom url for universal-fs with all the same benefits.

First create a function with the following type:

(app: Express, server?: http.Server) => Promise<string> | string;

You won't actually end up calling this function but universal-fs will. Here is an example of what this function could look like:

const startServer = (app: Express): string => {
  app.listen(3001, () => {
    console.log("listening on port 3001");
  });

This will tell universal-fs to listen on port 3001.

Now pass this function into the server.init() call:

const server = new Server({startServer});
 
await server.init();

Overall your total code should be:

const startServer = (app: Express): string => {
  app.listen(3001, () => {
    console.log("listening on port 3001");
  });
 
  return "http://localhost:3001";
};
 
const server = new Server({startServer});
 
await server.init();

Please note that your function MUST return the url the server is on whether that be remote or local.