❯ Guillaume Laforge

Nodejs

Serverless tip #7 — Create mini APIs with Cloud Functions and Express routing

Requirements: an existing Google Cloud Platform account and project Cloud Functions should be enabled for that project Compared to the previous tip when using Exress’ request path attribute, we can take advantage of Express routing. So to support the following paths: https://us-central1-myproject.cloudfunctions.net/api/customers https://us-central1-myproject.cloudfunctions.net/api/customers/32 https://us-central1-myproject.cloudfunctions.net/api/customers/32/address We can have our functions require Express by adding Express in package.json: { "name": "mini-api-router", "version": "0.0.1", "dependencies": { "express": "^4.17.1" } } Then we can require that dependency in our new functions script: Read more...

Serverless tip #6 — Create a mini web API with Cloud Functions

Requirements: an existing Google Cloud Platform account and project Cloud Functions should be enabled for that project We often use individual HTTP Cloud Functions as a single endpoint, and we pass data to the functions with either query parameters, or via a POST body payload. Although it’s a good practice to keep the scope of a function small, however, you can easily write mini Web APIs for a given function, with different paths for different needs, like with usual Web frameworks. Read more...

Automating Chrome Headless mode on App Engine with Node.JS 8

On the Google Cloud front today, the big news is the release of the new Node.JS 8 runtime for Google App Engine Standard. It’s been a while since a completely new runtime was added to the list of supported platforms (Python, Java, PHP, Go). You could already run anything in custom containers on App Engine Flex, including your own containerized Node app, but now you can have all the nice developer experience on the Standard environment, with fast deployment times, and 0 to 1 to n instance automatic scaling (you can see the difference between those two environments here). Read more...

A tight development loop for developing bots with API.ai, the Google Cloud Functions emulator, Node.js and Ngrok

For Google Cloud Next and Devoxx France, I’m working on a new talk showing how to build a conference assistant, to whom you’ll be able to ask questions like “what is the next talk about Java”, “when is Guillaume Laforge speaking”, “what is the topic of the ongoing keynote”, etc. For that purpose, I’m developing the assistant using API.AI. It’s a “conversational user experience platform” recently acquired by Google, which allows you to define various “intents” which correspond to the kind of questions / sentences that a user can say, and various “entities” which relate to the concepts dealt with (in my example, I have entities like “talk” or “speaker”). Read more...