File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 2222
2323import { apps } from './apps' ;
2424import * as _ from 'lodash' ;
25+ import { Request , Response } from 'express' ;
26+ export { Request , Response } ;
2527
2628/** An event to be handled in a developer's Cloud Function */
2729export interface Event < T > {
@@ -47,6 +49,12 @@ export interface TriggerAnnotated {
4749 } ;
4850}
4951
52+ /**
53+ * An HttpsFunction is both an object that exports its trigger definitions at __trigger and
54+ * can be called as a function that takes an express.js Request and Response object.
55+ */
56+ export type HttpsFunction = TriggerAnnotated & ( ( req : Request , resp : Response ) => void ) ;
57+
5058/**
5159 * A CloudFunction is both an object that exports its trigger definitions at __trigger and
5260 * can be called as a function using the raw JS API for Google Cloud Functions.
Original file line number Diff line number Diff line change 2020// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121// SOFTWARE.
2222
23- import { TriggerAnnotated } from '../cloud-functions' ;
23+ import { HttpsFunction } from '../cloud-functions' ;
2424import { Request , Response } from 'express' ;
25- export { Request , Response } ;
2625
27- export function onRequest (
28- handler : ( req : Request , resp : Response ) => void
29- ) : ( ( req : Request , resp : Response ) => void ) & TriggerAnnotated {
26+ export function onRequest ( handler : ( req : Request , resp : Response ) => void ) : HttpsFunction {
3027 // lets us add __trigger without altering handler:
3128 let cloudFunction : any = ( req , res ) => { handler ( req , res ) ; } ;
3229 cloudFunction . __trigger = { httpsTrigger : { } } ;
You can’t perform that action at this time.
0 commit comments