Hello World with Express Serverless Platform vs Apigee Edge

Apigee Edge (acquired by Google in 2016) is a popular platform for deploying API proxies. Express Serverless Platform, like Apigee, allows you to build and deploy API gateways on their internal cloud computing service. At a high level, Express Serverless Platform and Apigee are similar, but there are several key differences in terms of Node.js version compatibility and vendor lock-in that you should be aware of before choosing one or the other.

Deploying a Node.js Application to Apigee Edge

Before you deploy a Node.js app to Apigee, you need to be aware that Apigee currently only supports Node.js v0.10.32. There is no way to use another version. Node.js 0.10.32 was released in 2014 and  formally deprecated since 2016. Therefore, many modern Node.js libraries will not work on Apigee.


To create a new API Gateway with Apigee, log into the Apigee Edge console and click on “API Proxies.”:



Click on the add proxy button on the upper right corner to create a new proxy.


For a fair comparison with Express Serverless Platform, click “Node.js App” to create a new Node application, and upload the below hello-apigee.js file. Note that with Apigee, your Node.js app needs to expose an HTTP server, Apigee does not currently support any sort of function-as-a-service interface.


var http = require('http');

var svr = http.createServer(function(req, resp) {
 resp.end('Hello, World! ' + process.version + '\n');

svr.listen(9000, function() {
 console.log('The server is listening on port 9000');



In the “Security” step, select “Pass through” so make it easy to access your API Gateway. In production you would likely set API Key security here, but for this simple example you shouldn’t set up any security.



For the “Virtual Hosts” and “Build” steps, just hit next and skip those steps. When you get to the “Summary” step, Apigee will deploy your API Gateway for you.



Once your API Gateway is finished deploying, you should be able to access your endpoint using curl. Note: once again that the Node.js version is v0.10.32.


$ curl http://val-eval-test.apigee.net/test
Hello, World! v0.10.32


You may see the following error when accessing your endpoint using curl. This error usually occurs because it takes a little time for Apigee to finish deploying your API Gateway after the web interface says it is done. If you see this error, wait a couple minutes and try again.


{"fault":{"faultstring":"APIProxy revision 1 of test does not exist in environment test of organization val-eval","detail":{"errorcode":"messaging.runtime.ApplicationNotFound"}}}


For more sophisticated Node.js applications you need to use Apigee’s apigeetool library to bundle your application. Unfortunately, apigeetool is known for giving mysterious HTTP 401 errors with no further information, so working with apigetool requires more sophistication.


Express Serverless Platform and Express Gateway

In Express Serverless Platform, first create a new function and name it ‘myfunction’:



Node.js functions in Express Serverless Platform have the same function signature as native Node.js HTTP request listeners. The function to print ‘Hello, world!’ with Express Serverless Platform is shown below. Note that the exported function must have the same name as the function name you assigned in the Express Serverless Platform GUI.


module.exports = {
  myfunction (req, res) {
    res.end(Hello, world!);

Note that this function does not have to create an actual HTTP server. Express Serverless Platform handles creating a server for you, so you can write “serverless” functions without having to actually write an express application. You do still get access to the Node.js HTTP response, so you can set HTTP headers and set the HTTP status code.


From the menu on the left, add a new gateway. This will add an Express Gateway instance to your project.



Click the plus icon next to “Policies” to add a policy to the default Express Gateway pipeline. In Express Gateway, a pipeline is a sequence of policies for handling a request. Add an empty ‘proxy’ pipeline.



Drag a line from your gateway to your function, and Express Serverless Platform will automatically connect your proxy policy to your function.



Express Serverless Platform will also create a function endpoint for you. Keep the “paths” for your function endpoint empty for now. Click on the “settings” icon to find the publicly accessible URL for your Express Serverless Platform project.



Running curl on the URL will now run your custom function and give you the “Hello, world!” text.


$ curl http://gateway-148-dev.lunchbadger.io
Hello, World!

Moving On

The combination of Express Serverless Platform and Express Gateway is a great alternative to Apigee for Node.js developers if you’re looking to leverage modern JavaScript.   In particular, Apigee requires you to use a version of Node.js that’s been deprecated for several years at the time of this writing.   Express Serverless Platform also allows you to simply write functions, rather than requiring you to build out a whole server application and then deploy it using an error-prone command line tool. Apigee is appealing if you want to deploy an existing Node.js application somewhere, or if you don’t want to use Node.js and just use their web GUI to configure your API Gateway.   However, the latter approach suffers from vendor lock-in, because you can’t simply take your API Gateway from Apigee’s GUI and run it locally or on a different cloud provider.   Express Serverless Platform’s GUI generates a git project for you, so you can clone your entire API Gateway stack, modify it in your preferred code editor, and run it locally or on your cloud provider of choice.  

We’ve done up a detailed comparison analysis on features, pricing and more between Express Serverless Platform and Apigee Edge, which is available for download from our Resources page.

Additionally, if you’re interested in more of these topics, join the live discussion on twitter @lunchbadger or @express_gateway.


Share Tweet Link