• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
xhaka

xhaka

ipAddress

Public
Like
ipAddress
Home
Code
3
examples
2
README.md
H
index.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/21/2025
Viewing readonly version of main branch: v5
View latest version
README.md

Restaurant Server IP Registry

This Val Town project provides a simple service to help a React Native mobile app discover and connect to a restaurant server running on a desktop application.

Problem Solved

In a restaurant management system where:

  • A desktop application runs the server with APIs
  • A React Native mobile app needs to connect to those APIs
  • The server's IP address might change

This service acts as a bridge that allows the server to register its current IP address and the mobile app to discover it.

How It Works

  1. Server Registration: When the desktop server starts, it sends its current IP address to this service
  2. Mobile App Discovery: The mobile app queries this service to get the latest server IP address
  3. Direct Connection: The mobile app then connects directly to the server using the discovered IP

Endpoints

Register Server IP (For Desktop Server)

POST /register
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json

{
  "ipAddress": "192.168.1.100",
  "port": 8080
}

Get Server IP (For Mobile App)

GET /

Response:

{ "ipAddress": "192.168.1.100", "port": 8080, "updatedAt": "2023-06-15T12:34:56.789Z" }

Implementation Details

  • Uses Val Town's blob storage to persist the server IP address
  • Includes basic token authentication for the registration endpoint
  • Provides CORS headers to allow cross-origin requests from the mobile app

Setup Instructions

  1. Set the SERVER_REGISTER_TOKEN environment variable in Val Town for security
  2. Configure the desktop server to call the registration endpoint on startup
  3. Configure the React Native app to query this service before making API calls
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.