GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

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

Open
#692 0 comments 2 reactions 0 assignees View on GitHub
enhancement P2
Dominant language
TypeScript
Stars
1.4k
Forks
181
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing CLI startup path and the exported main entry point in functions-framework. The request proposes src/server.js or src/server.ts as a direct Node entrypoint; done means users can invoke main directly while preserving the current CLI behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.