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

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.