服务器端点 可用作 REST API 端点来运行身份验证、数据库访问和验证等功能,而无需向客户端暴露敏感数据。
¥Server endpoints can be used as REST API endpoints to run functions such as authentications, database access, and verifications without exposing sensitive data to the client.
在本秘籍中,API 路由用于验证 Google reCAPTCHA v3,而不会将秘密暴露给客户端。
¥In this recipe, an API route is used to verify Google reCAPTCHA v3 without exposing the secret to clients.
Create a POST endpoint that accepts recaptcha data, then verifies it with reCAPTCHA’s API. Here, you can safely define secret values or read environment variables.
Access your endpoint using fetch from a client script: