@@ -376,14 +376,123 @@ In the v4 model, registering extra inputs has been moved from `function.json` fi
376
376
# [v4 model](#tab/v4)
377
377
378
378
` ` ` javascript
379
+ const { app } = require(' @azure/functions' );
380
+ const df = require(' durable-functions' );
379
381
382
+ app.http(' durableHttpStart' , {
383
+ route: ' orchestrators/{orchestratorName}' ,
384
+ extraInputs: [df.input.durableClient()],
385
+ handler: async (_request, context) => {
386
+ const client = df.getClient(context);
387
+ // Use client in function body
388
+ },
389
+ });
380
390
` ` `
381
391
382
392
# [v3 model](#tab/v3)
383
393
394
+ ` ` ` javascript
395
+ const df = require(" durable-functions" );
396
+
397
+ module.exports = async function (context, req) {
398
+ const client = df.getClient(context);
399
+ // Use client in function body
400
+ };
401
+ ` ` `
402
+
403
+ ` ` ` json
404
+ {
405
+ " bindings" : [
406
+ {
407
+ " authLevel" : " anonymous" ,
408
+ " name" : " req" ,
409
+ " type" : " httpTrigger" ,
410
+ " direction" : " in" ,
411
+ " route" : " orchestrators/{functionName}" ,
412
+ " methods" : [
413
+ " post" ,
414
+ " get"
415
+ ]
416
+ },
417
+ {
418
+ " name" : " $return " ,
419
+ " type" : " http" ,
420
+ " direction" : " out"
421
+ },
422
+ {
423
+ " name" : " starter" ,
424
+ " type" : " durableClient" ,
425
+ " direction" : " in"
426
+ }
427
+ ]
428
+ }
429
+ ` ` `
430
+
384
431
---
385
432
:::zone-end
386
433
387
434
:::zone pivot=" programming-language-typescript"
388
435
436
+ # [v4 model](#tab/v4)
437
+
438
+ ` ` ` typescript
439
+ import { app, HttpHandler, HttpRequest, HttpResponse, InvocationContext } from ' @azure/functions' ;
440
+ import * as df from ' durable-functions' ;
441
+
442
+ const durableHttpStart: HttpHandler = async (request: HttpRequest, context: InvocationContext): Promise< HttpResponse> => {
443
+ const client = df.getClient(context);
444
+ // Use client in function body
445
+ };
446
+
447
+ app.http(' durableHttpStart' , {
448
+ route: ' orchestrators/{orchestratorName}' ,
449
+ extraInputs: [df.input.durableClient()],
450
+ handler: durableHttpStart,
451
+ });
452
+ ` ` `
453
+
454
+ # [v3 model](#tab/v3)
455
+
456
+ ` ` ` typescript
457
+ import * as df from " durable-functions"
458
+ import { AzureFunction, Context, HttpRequest } from " @azure/functions"
459
+
460
+ const durableHttpStart: AzureFunction = async function (context: Context): Promise< any> {
461
+ const client = df.getClient(context);
462
+ // Use client in function body
463
+ };
464
+
465
+ export default durableHttpStart;
466
+ ` ` `
467
+
468
+ ` ` ` json
469
+ {
470
+ " bindings" : [
471
+ {
472
+ " authLevel" : " anonymous" ,
473
+ " name" : " req" ,
474
+ " type" : " httpTrigger" ,
475
+ " direction" : " in" ,
476
+ " route" : " orchestrators/{functionName}" ,
477
+ " methods" : [
478
+ " post" ,
479
+ " get"
480
+ ]
481
+ },
482
+ {
483
+ " name" : " $return " ,
484
+ " type" : " http" ,
485
+ " direction" : " out"
486
+ },
487
+ {
488
+ " name" : " starter" ,
489
+ " type" : " durableClient" ,
490
+ " direction" : " in"
491
+ }
492
+ ],
493
+ " scriptFile" : " ../dist/durableHttpStart/index.js"
494
+ }
495
+ ` ` `
496
+
497
+ ---
389
498
:::zone-end
0 commit comments