A practical guide for building a log server using Express.js, ngrok and Swift. This setup allows devices without localhost access to send logs via an ngrok URL, making remote logging easy and accessible.
-
Clone the repository:
git clone https://github.com/yourusername/LogAnywhere.git cd LogAnywhere -
Change to log server directory:
cd log-server -
Install dependencies:
npm install
-
Start the server:
node server.js
To expose your local server to the internet, you need to use ngrok. Follow the instructions in the ngrok README to set up ngrok and obtain a public URL.
-
Open the Swift project:
- Navigate to the
DeviceInfoLoggerdirectory. - Open
SwiftApp.xcodeprojin Xcode.
- Navigate to the
-
Configure the ngrok URL:
- In the Swift project, locate the ContentView and where the server URL is set.
- Replace the existing URL with your ngrok URL.
-
Run the Swift app:
- Build and run the app on your device or simulator.
- Use the app interface to send logs to your server.