GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

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

Đang mở
#692 0 bình luận 2 reaction 0 người được giao Xem trên GitHub
enhancement P2
Ngôn ngữ chính
TypeScript
Star
1.4k
Fork
181
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách lần theo đường dẫn khởi động CLI hiện có và điểm vào main được export trong functions-framework. Yêu cầu này đề xuất src/server.js hoặc src/server.ts làm điểm vào Node trực tiếp; hoàn thành nghĩa là người dùng có thể gọi trực tiếp main trong khi vẫn giữ nguyên hành vi CLI hiện tại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js, typescript
Lĩnh vực
backend, cli
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.