Skip to content

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

Open
@cctidal

Description

@cctidal

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:

import {main} from 'functions-framework'

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

main(handle)

I'd be willing to implement this feature

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions