File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ npm install @google-cloud/functions-framework
6868 };
6969 ```
7070
71+ Option 1 :
72+
71731. Run the following command:
7274
7375 ` ` ` sh
@@ -76,6 +78,33 @@ npm install @google-cloud/functions-framework
7678
77791. Open http: // localhost:8080/ in your browser and see _Hello, World_.
7880
81+ Option 2 :
82+
83+ 1. Create a ` main.js` file with the following contents:
84+
85+ ` ` ` js
86+ import { run } from '@google-cloud/functions-framework';
87+ import { helloWorld } from './hello.js';
88+
89+ run(helloWorld);
90+ ` ` `
91+
92+ 1. Run ` node main.js` to start the local development server to serve the function:
93+
94+ ```
95+ Serving function...
96+ Function: function
97+ Signature type: http
98+ URL: http://localhost:8080/
99+ ```
100+
101+ 1. Send requests to this function using `curl` from another terminal window:
102+
103+ ```sh
104+ curl localhost:8080
105+ # Output: Hello, World
106+ ```
107+
79108### Quickstart: Set up a new project
80109
811101. Create a `package.json` file using `npm init`:
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ describe('programmatic functions', () => {
6565 } ) ;
6666
6767 it ( 'should run a CloudEvent function' , async ( ) => {
68+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6869 let receivedEvent : any = null ;
6970 const cloudEventFunc : CloudEventFunction = cloudEvent => {
7071 receivedEvent = cloudEvent ;
You can’t perform that action at this time.
0 commit comments