Debugging

This commit is contained in:
2024-06-17 17:15:47 -04:00
parent 2a96dbc70c
commit bf79d023b8

View File

@@ -10,7 +10,20 @@ type Context = {
error: (msg: any) => void;
};
export default async function ({req, res, error}: Context){
export default async function ({req, res, log,error}: Context){
// Output some info
log(req.bodyRaw); // Raw request body, contains request data
log(JSON.stringify(req.body)); // Object from parsed JSON request body, otherwise string
log(JSON.stringify(req.headers)); // String key-value pairs of all request headers, keys are lowercase
log(req.scheme); // Value of the x-forwarded-proto header, usually http or https
log(req.method); // Request method, such as GET, POST, PUT, DELETE, PATCH, etc.
log(req.url); // Full URL, for example: http://awesome.appwrite.io:8000/v1/hooks?limit=12&offset=50
log(req.host); // Hostname from the host header, such as awesome.appwrite.io
log(req.port); // Port from the host header, for example 8000
log(req.path); // Path part of URL, for example /v1/hooks
log(req.queryString); // Raw query params string. For example "limit=12&offset=50"
log(JSON.stringify(req.query)); // Parsed query params. For example, req.query.limit
const PROJECT_ID = Deno.env.get("APPWRITE_FUNCTION_PROJECT_ID")
const API_KEY = Deno.env.get("APPWRITE_API_KEY")