Hosting Your App
How to host and run your app on Senza
Local files
For local development, this is the easiest way to view an HTML page as it requires no setup. It will of course only work on your own computer, and only in your web browser. Some web apps may not be able to load resources as expected when using file:/// URLs due to cross-site scripting restrictions.
Localhost
The next step beyond using local files is to serve them from your computer’s built-in web server. This may be required for running web apps that aren't compatible with file:/// URLs, and will let you work with ngrok. Here are some instructions for turning on the web server in macOS Sonoma.
Node.js
Sometimes instead of using an ordinary web server you want to serve dynamic content, for example using an app written in Node.js. This would typically run on a different port than your local web server, such as 8080.
Web server
With Senza, as the web browser that renders your content is running in the cloud, it can’t connect directly to your local development environment. Therefore you’ll need to host your web content on a web server with a publicly accessible hostname. For production, you'll need a reliable, fast, and secure web server. You can host your content there during development, but it might slow down the process of testing your app.
- Deploying Node.js Apps on Google Cloud Platform or Azure
Ngrok
What if you want to serve your content locally, but make it available on the public internet so that it works with Senza? There’s a tool called ngrok that works like magic: it creates a tunnel from a public hostname to a web server on your local computer. It gets you the best of both worlds: you can develop locally and see your changes in the Senza environment. See the page on using ngrok to load a website from your computer.
Updated 4 months ago