Gathering detailed insights and metrics for @crabas0npm/quis-tenetur-nam
Gathering detailed insights and metrics for @crabas0npm/quis-tenetur-nam
npm install @crabas0npm/quis-tenetur-nam
Typescript
Module System
Node Version
NPM Version
54.5
Supply Chain
48.1
Quality
75.5
Maintenance
100
Vulnerability
99.6
License
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
1
Compared to previous week
Last month
133.3%
7
Compared to previous month
Last year
0%
138
Compared to previous year
33
This project is ment to be used with Microsoft Azure Functions. This simple wrapper makes it easier to work with Azure Functions since common HTTP methods are wrapped to individual function calls within a specfic Azure Function. And in addition a function can be executed before each method will be executed.
In the following example a get and a post function a defined and passed as parameters in the advancedHTTPtrigger Function. The first optional parameter can be given a function which is executed before ether the get or post functions will be executed. The return value will be injected as the data parameter in each function.
If you now call that function using the GET method you will see the response GET: test
and via the POST method you will see POST: test
.
1const get: AdvancedHTTPMethod<string> = async (context: Context, req: HttpRequest, data: String) => { 2 context.res = { 3 body: 'GET: ' + data 4 }; 5}; 6 7const post: AdvancedHTTPMethod<string> = async (context: Context, req: HttpRequest, data: String) => { 8 context.res = { 9 body: 'POST: ' + data 10 }; 11}; 12 13export default advancedHTTPTrigger<string>({ get, post }, async (context, req) => 'test');
There is a another function, that helps with authentication in Azure Functions. If authentication is setup properly, one can check the x-ms-client-principal-id
which will contain the "userId" if the user authenticated successfully.
In the example below the get function will only be executed if the user was successfully authenticated.
1const get: AdvancedHTTPMethod<string> = async ( 2 context: Context, 3 req: HttpRequest, 4 data: { userId: string; dataId: string } 5) => { 6 context.res = { 7 body: data 8 }; 9 context.done(); 10}; 11 12export default authenticatedHTTPTrigger({ get });
No vulnerabilities found.
No security vulnerabilities found.