GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

Feature request: export "main" entrypoint to allow using it directly instead of using the cli

オープン
#692 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る
enhancement P2
主要言語
TypeScript
スター
1.4k
フォーク
181
PR マージ指標
30日以内にマージされた PR はありません

説明

I'm interested in using the main entrypoint function directly instead of using the cli to start up the function, mostly on the development environment.

This has some advantages, among others:

- Can be started with node directly: `node src/server.js`
- Can use node watcher, no need for extra setup with nodemon&others: `node --watch src/server.js`
- Better typescript support with ts-node/tsx: `tsx --watch src/server.ts`

This server.js would use the exported main entry point:

```js
import {main} from 'functions-framework'

import {handle} from './index.js'

main(handle)
```

I'd be willing to implement this feature

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、既存のCLI起動パスと、functions-frameworkでエクスポートされているmainエントリポイントを追跡します。このリクエストでは、src/server.jsまたはsrc/server.tsをNodeの直接エントリポイントとして提案しています。ユーザーがmainを直接呼び出せ、現在のCLIの動作が維持されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
node.js, typescript
領域
backend, cli
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。