Skip to content
Snippets Groups Projects
Commit aa862379 authored by Daniel Walsh's avatar Daniel Walsh
Browse files

Move API ref as is

parent 9856cff0
Branches
No related tags found
No related merge requests found
...@@ -405,6 +405,7 @@ ...@@ -405,6 +405,7 @@
/pages/how-to/elderjs/ /pages/framework-guides/elderjs/ 301 /pages/how-to/elderjs/ /pages/framework-guides/elderjs/ 301
/pages/platform/github-integration/ /pages/platform/git-integration/ 301 /pages/platform/github-integration/ /pages/platform/git-integration/ 301
/pages/platform/direct-uploads/ /pages/platform/direct-upload/ 301 /pages/platform/direct-uploads/ /pages/platform/direct-upload/ 301
/platform/functions/billing/ /platform/functions/pricing/ 301
# partners # partners
/partners/ /learning-paths/technology-partner-integrations/ 301 /partners/ /learning-paths/technology-partner-integrations/ 301
......
...@@ -3,3 +3,63 @@ pcx-content-type: how-to ...@@ -3,3 +3,63 @@ pcx-content-type: how-to
title: API Reference title: API Reference
weight: 3 weight: 3
--- ---
The following APIs are used within Functions.
## Methods
<Some text about these>
### onRequests
{{<definitions>}}
- {{<code>}}onRequest(context[{{<param-type>}}EventContext{{</param-type>}}](#eventcontext)){{</code>}} {{<type>}}Response | Promise&lt;Response&gt;{{</type>}}
- This function will be invoked on all requests no matter the request method
- {{<code>}}onRequestGet(context[{{<param-type>}}EventContext{{</param-type>}}](#eventcontext)){{</code>}} {{<type>}}Response | Promise&lt;Response&gt;{{</type>}}
- This function will be invoked on all GET requests
- {{<code>}}onRequestPost(context[{{<param-type>}}EventContext{{</param-type>}}](#eventcontext)){{</code>}} {{<type>}}Response | Promise&lt;Response&gt;{{</type>}}
- This function will be invoked on all POST requests
- {{<code>}}onRequestPatch(context[{{<param-type>}}EventContext{{</param-type>}}](#eventcontext)){{</code>}} {{<type>}}Response | Promise&lt;Response&gt;{{</type>}}
- This function will be invoked on all PATCH requests
- {{<code>}}onRequestPut(context[{{<param-type>}}EventContext{{</param-type>}}](#eventcontext)){{</code>}} {{<type>}}Response | Promise&lt;Response&gt;{{</type>}}
- This function will be invoked on all PUT requests
- {{<code>}}onRequestDelete(context[{{<param-type>}}EventContext{{</param-type>}}](#eventcontext)){{</code>}} {{<type>}}Response | Promise&lt;Response&gt;{{</type>}}
- This function will be invoked on all DELETE requests
- {{<code>}}onRequestHead(context[{{<param-type>}}EventContext{{</param-type>}}](#eventcontext)){{</code>}} {{<type>}}Response | Promise&lt;Response&gt;{{</type>}}
- This function will be invoked on all HEAD requests
- {{<code>}}onRequestOptions(context[{{<param-type>}}EventContext{{</param-type>}}](#eventcontext)){{</code>}} {{<type>}}Response | Promise&lt;Response&gt;{{</type>}}
- This function will be invoked on all OPTIONS requests
{{</definitions>}}
### env.ASSETS.fetch()
The env.ASSETS.fetch() function allows you to fetch a static asset. Requests to this will be to the pretty path not directly to the asset (i.e. if you had the path: `functions/users/index.html`, you will request /users/ instead of /users/index.html). This will run the header and redirect rules, so they will modify the response that is returned.
## Types
### EventContext
{{<definitions>}}
The following are the properties on the context object which are passed through on the onRequest methods:
- `request` [{{<type>}}Request{{</type>}}](/workers/runtime-apis/request/)
This is the incoming [Request](/workers/runtime-apis/request/).
- `functionPath` {{<type>}}string{{</type>}}
- {{<code>}}waitUntil(promise{{<param-type>}}Promise&lt;any&gt;{{</param-type>}}){{</code>}} {{<type>}}void{{</type>}}
- {{<code>}}passThroughOnException(){{</code>}} {{<type>}}void{{</type>}}
- {{<code>}}next(input?{{<param-type>}}Request | string{{</param-type>}}, init?{{<param-type>}}RequestInit{{</param-type>}}){{</code>}} {{<type>}}Promise&lt;Response&gt;{{</type>}}
- `env` [{{<type>}}EnvWithFetch{{</type>}}](#envwithfetch)
- `param` [{{<type>}}Params&lt;P&gt;{{</type>}}](#params)
- `data` [{{<type>}}Data{{</type>}}](#data)
{{</definitions>}}
### EnvWithFetch
### Params
### Data
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment