Update configuration to get endpoint information
This commit is contained in:
@@ -10,29 +10,18 @@ type Context = {
|
||||
error: (msg: any) => void;
|
||||
};
|
||||
|
||||
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
|
||||
export default async function ({req, res, error}: Context){
|
||||
|
||||
const PROJECT_ID = Deno.env.get("APPWRITE_FUNCTION_PROJECT_ID")
|
||||
const API_KEY = Deno.env.get("APPWRITE_API_KEY")
|
||||
if ( !PROJECT_ID || !API_KEY) {
|
||||
const API_ENDPOINT = Deno.env.get("APPWRITE_API_ENDPOINT")
|
||||
|
||||
if ( !PROJECT_ID || !API_KEY || !API_ENDPOINT) {
|
||||
error('Environment not set');
|
||||
return {};
|
||||
}
|
||||
const client = new Client()
|
||||
.setEndpoint('https://appwrite.oys.undock.ca/v1')
|
||||
.setEndpoint(API_ENDPOINT)
|
||||
.setProject(PROJECT_ID)
|
||||
.setKey(API_KEY)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user