<html>
<h1>
</h1>
<h1>Enter Customer Information</h1>
<br>
<br>
URL for function
<form method="GET" action="https://us-central1-http-example-246018.cloudfunctions.net/record">
Message: <input type="text" name="message"><br>
<input type="submit" value="Submit form">
</form>
</html>
function
exports.record = (req, res) => {
// Construct message
let message = constructMessage(req);
res.status(200).send(message);
};
constructMessage = (req) => {
// Read query string parameter `message`, HTTP GET
let message = req.query.message;
// Create response
let response = '{"value": "' + message + '"}';
// Parse the response as JSON then return
return JSON.parse(response);
};
index.html
No comments:
Post a Comment