Develop serverless edge functions with PubNub Functions 2.0
Agent Success
Agent success rate when using this tile
93%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.79x
Baseline
Agent success rate without this tile
52%
You are building a simple user profile API as a PubNub Function that will be called from a web browser frontend. The API stores and retrieves user profiles from the function's key-value store. The frontend is hosted on a different domain than the PubNub Function endpoint, so browser security restrictions apply.
Write a PubNub On Request function (user-api.js) that implements a RESTful user profile API supporting:
User IDs are provided via URL path parameters.
user-api.js file containing a complete PubNub On Request function implementing the user profile API.