‹ Back to My Code
systems lua
-- Server: define a typed GET route and respond with JSON-like data.
local RoExpress = require(game.ReplicatedStorage.RoExpress)
local app = RoExpress.GetApp()

app:Get("player/:userId=number", function(req, res)
	res:Send({ userId = req.params.userId })
end)

-- Client: request the route and unwrap the response with a Promise.
local network = RoExpress.GetNetwork()

network:GetAsync("player/123"):Then(function(res)
	return res.data
end)