Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .af/function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

import { Buffer as _globalFleekBuffer } from "node:buffer";
import { AsyncLocalStorage as _globalFleekAsyncLocalStorage } from "node:async_hooks";
import { PerformanceObserver as _globalFleekPerformanceObserver, performance as _globalFleekPerformance } from 'node:perf_hooks';
globalThis.Buffer = _globalFleekBuffer;
globalThis.AsyncLocalStorage = _globalFleekAsyncLocalStorage;
globalThis.performance = _globalFleekPerformance;
globalThis.PerformanceObserver = _globalFleekPerformanceObserver;
globalThis.process = {
...globalThis.process,
env: {
...globalThis.process.env,
AF_URL: "https://hello-cli.af-functions.dev"
}
};
globalThis.fleek = {
env: {
AF_URL: "https://hello-cli.af-functions.dev"
}
};

var r={async fetch(e){let t=new URL(e.url),n={ok:!0,message:"hello from Alternate Futures function",method:e.method,path:t.pathname,query:Object.fromEntries(t.searchParams.entries()),now:new Date().toISOString()};return new Response(JSON.stringify(n,null,2),{status:200,headers:{"content-type":"application/json; charset=utf-8"}})}};export{r as default};
21 changes: 21 additions & 0 deletions hello-function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default {
async fetch(request) {
const url = new URL(request.url);
const body = {
ok: true,
message: 'hello from Alternate Futures function',
method: request.method,
path: url.pathname,
query: Object.fromEntries(url.searchParams.entries()),
now: new Date().toISOString(),
};

return new Response(JSON.stringify(body, null, 2), {
status: 200,
headers: {
'content-type': 'application/json; charset=utf-8',
},
});
},
};

4 changes: 3 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,5 +361,7 @@
"functionsSite": "The Site ID where the Function will be deployed",
"siteNotFound": "Site not found!",
"failedAuthentication": "This command failed to authenticate. Have you run 'af login' to sign in? If the issue persists contact our support team at https://alternatefutures.ai/support",
"missingPersonalAccessToken": "Missing a valid personal access token. Visit https://alternatefutures.ai/docs for detailed instructions and try again, please!"
"missingPersonalAccessToken": "Missing a valid personal access token. Visit https://alternatefutures.ai/docs for detailed instructions and try again, please!",
"userDescription": "Show information about the authenticated user",
"userMeDescription": "Show the currently authenticated user"
}
Loading