microsoft / microsoft/typespec

[hsj] Change router so that it can be instantiated with a record of route controllers instead of positional params

Open
#6,539 1 comment 0 reactions 0 assignees View on GitHub
emitter:service:js feature triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

The generated HTTP router for the JS server generator currently accepts route controllers as positional arguments, but it should use a record or other associative structure instead. The positional nature of the router instantiation makes it sensitive to the order of declaration in TypeSpec and as new services are added the order of the route controllers is changing, requiring many changes to the `createRouter` call.

We want:

```ts
const router = createRouter({
example: new Example()
});
```

instead of:

```ts
const router = createRouter(new Example());
```

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.