Skip to content

Commit

Permalink
Rename tRpcAzureFunctionsPlugin to unstable prefix (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize authored Jan 20, 2024
2 parents 2cd4626 + 4d2854e commit e64d620
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 188 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.eslintrc.js
.eslintrc.js
examples
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ npm start

### Available Adatpers

- [azure-functions][@nammatham/azure-functions], Azure Functions Adapter for Nammatham
- [azure-functions][@nammatham/azure-functions], Azure Functions Adapter for Nammatham, internally, Azure Functions in local dev mode is dependend on Express.js.

### Available Plugins

Expand Down
18 changes: 18 additions & 0 deletions examples/azure-functions-with-trpc/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @examples/azure-functions-with-trpc

> Unstable API, please use in your own risk, any PRs are welcome!
## Usage

```ts
// No need to call expressPlugin() in dev mode, as it is already called by nammathamTrpcPlugin()
// app.register(expressPlugin());
app.register(
unstable__tRpcAzureFunctionsPlugin({
prefix: '/trpc',
trpcOptions: {
router: appRouter,
createContext,
}
})
);
```

## Run Dev Server

```
Expand Down
4 changes: 2 additions & 2 deletions examples/azure-functions-with-trpc/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { tRpcAzureFunctionsPlugin } from '@nammatham/trpc-azure-functions';
import { unstable__tRpcAzureFunctionsPlugin } from '@nammatham/trpc-azure-functions';
import { app } from './nammatham';
import { appRouter, createContext } from './router';

// No need to call expressPlugin() in dev mode, as it is already called by nammathamTrpcPlugin()
// app.register(expressPlugin());
app.register(
tRpcAzureFunctionsPlugin({
unstable__tRpcAzureFunctionsPlugin({
prefix: '/trpc',
trpcOptions: {
router: appRouter,
Expand Down
3 changes: 1 addition & 2 deletions examples/azure-functions-with-trpc/src/nammatham.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { initNammatham } from '@nammatham/core';
import { AzureFunctionsAdapter } from '@nammatham/azure-functions';

const n = initNammatham.create(new AzureFunctionsAdapter());
n.func;
// ^?

export const func = n.func;
export const app = n.app;
7 changes: 6 additions & 1 deletion packages/trpc-azure-functions/src/trpc-azure-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export interface TrpcAzureFunctionsPluginOption<TRouter extends AnyRouter> {
expressPluginOption?: ExpressServerOption;
}

export function tRpcAzureFunctionsPlugin<TRouter extends AnyRouter>(option: TrpcAzureFunctionsPluginOption<TRouter>) {
/**
* tRPC plugin for AzureFunctions
* Unstable, some features are not implemented yet.
*/

export function unstable__tRpcAzureFunctionsPlugin<TRouter extends AnyRouter>(option: TrpcAzureFunctionsPluginOption<TRouter>) {
return (app: NammathamApp, handlerResolver: BaseHandlerResolver) => {
logger.info(`Using plugin: tRPC for AzureFunctions`);

Expand Down
Loading

0 comments on commit e64d620

Please sign in to comment.