Azure / Azure/azure-functions-nodejs-library

v4 allow registering separate http methods to the same route

Open
#98 4 comments 3 reactions 0 assignees View on GitHub
area:nodejs-functions feature P2
Dominant language
TypeScript
Stars
70
Forks
35
Avg merge
4d 18h
Merged PRs (30d)
6

Description

Hello,

With v4 nodejs typescript, I'm trying to create two functions with the same name but different methods. Like this:
```typescript
app.get("users", {
authLevel: "anonymous",
handler: getUser,
});

app.patch("users", {
authLevel: "anonymous",
handler: patchUser,
});
```

I would expect to have 2 functions running.
But when running locally with `func start` I get only one.

Here is the logs:

```
Azure Functions Core Tools
Core Tools Version: 4.0.5198 Commit hash: N/A (64-bit)
Function Runtime Version: 4.21.1.20667

[2023-05-31T12:35:16.018Z] Worker process started and initialized.

Functions:

users: [PATCH] http://localhost:7071/api/users

For detailed output, run func with --verbose flag.
[2023-05-31T12:35:20.977Z] Host lock lease acquired by instance ID '00000000000000000000000023AC63E5'.
```

It looks like the second one is overriding the first one.

I could use `app.http(...)` but it would be far easier if the express like way if doing things was working out of the box.
Do you know of some way I could achieve this ?

#### Related information

Version: [4.0.0-alpha.10](https://www.npmjs.com/package/@azure/functions/v/4.0.0-alpha.10)
OS: Linux

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.