Why is Node.js a good choice for building APIs? What is Swagger 2.0 and how can you use it to create your API documentation?
Join Jeff West and Marsh Gardiner for a code and demo-filled session, in which we’ll design an API with Swagger 2.0 and then implement and deploy the API in Node.js on both Apigee and AWS.
We will 'show the code’ to:
• Build production-grade APIs in Node.js with Apigee-127
• Create API documentation with Swagger 2.0
• Add enterprise capabilities like OAuth, quota, caching, and analytics using NPMs (Node Package Manager)
• Deploy to any PaaS, including Apigee, Amazon AWS, and Heroku
View video: http://youtu.be/Fw43z14Y1Xw
View podcast: https://soundcloud.com/apigee/build-apis-in-nodejs-and-swagger-20-with-apigee-127
A study of our platform and found that a majority of developers use JavaScript in their APIs. Sometimes for simple logic and sometimes for full API implementation in Node.js. JavaScript is a great language for APIs. Web developers use JavaScript every day to deliver great experiences through their apps. With JavaScript for APIs, developers can use the same language to build the APIs they need to enable those experiences - side-by-side with the applications themselves – without switching languages.
At Apigee we’re all-in on the swagger specification for API modeling. Swagger supports both YAML and JSON formats and enables you to generate both server and client code as well as documentation. Vendor extensions have been added to 2.0 as well. This allows you to take advantage of value-added services from vendors like Apigee using metadata - and without writing a single line of vendor specific code.
The Swagger 2.0 working group is lead by Tony Tam at Wordnik and includes representatives from software vendors like Apigee, Microsoft and Symantec. It also includes companies who build and consume APIs such as Mckesson, Morningstar and Kaplan. This is very important to note – this is not just a group of vendors or worse just one vendor coming up with ideas about how this should be done. We have representation from end-customers of APIs and system integrators in addition to vendors.
At Apigee we’re all-in on the swagger specification for API modeling. Swagger supports both YAML and JSON formats and enables you to generate both server and client code as well as documentation. Vendor extensions have been added to 2.0 as well. This allows you to take advantage of value-added services from vendors like Apigee using metadata - and without writing a single line of vendor specific code.
The Swagger 2.0 working group is lead by Tony Tam at Wordnik and includes representatives from software vendors like Apigee, Microsoft and Symantec. It also includes companies who build and consume APIs such as Mckesson, Morningstar and Kaplan. This is very important to note – this is not just a group of vendors or worse just one vendor coming up with ideas about how this should be done. We have representation from end-customers of APIs and system integrators in addition to vendors.
The focal point of Apigee 127 is the swagger editor. Apigee built and contributed the swagger editor to the open source community and we are really proud of it. . It provides a great authoring experience for building API specs. On the left-hand side, you have YAML and on the right side you have a preview of what your documentation could look like with the swagger UI.
With the swagger editor you define the metadata associated with your API such as your resource paths, operations, parameters and request and response models. This metadata can be used to generate servers and clients in many different programming languages in addition to documentation.
As an Apigee customer, you can take models like this and generate rich, interactive documentation called smartdocs that really shows off your API.
Apigee 127 is available now and can be installed using NPM. We’ve been building it in the open on GitHub for a few months and we’re in great shape to start having developers use it. We are using GitHub issues for tracking problems, so if you have problems you have a channel to get help.
The – G option is necessary to put the a127 cli on your path. This tool enables you to create projects and manage their lifecycle, including deploying them to Apigee.
Apigee 127 provides tooling to take this model and generate a node application which uses the metadata to perform typical API functions like message validation, caching, quota, authorization. The metadata in the Swagger spec drives the behavior of the server! It’s really awesome.
With the Apigee 127 programming model the only code that you need to write is the business logic to support the operations you want to expose an API. We address all of the standard functions associated with an API. We accomplish this using the swagger tools that we provided to the community as well as the Volos JS libraries and extensions to the swagger specification.
This gives you a great starting point for building new APIs. However, you can also plug in your existing Node code and still take advantage of this approach.
If you are worried about vendor lock-in you have nothing to fear, just because you use our extensions to the specification doesn’t mean you’re locked into apigee.
As the name implies Apigee127 provides a development environment that it can be completely run on a developer’s laptop. On the right you can see the different models that we have contributed to make this possible. In addition to the tools for building APIs we also provide a really great experience with Apache Usergrid which is the open-source version of Apigee’s Backend as a Service on your laptop.
http://www.ptisd.org/users/0001/Clipart/macbook-800wi.jpg
Volos gives API developers a service provider framework they can use to wire services into their APIs like Caching, Quota and OAuth. It’s also designed in a way that is completely extensible. For instance, if you wanted to use memcached for caching you can write a simple module that integrates with the Volos framework.
When you develop APIs using Volos, you can do things locally like in-memory caching or redis-backed quota management – and when you deploy them to Apigee you can leverage the Apigee’s distributed caching and distributed quota with little or no code changes. This is a really powerful tool that we have in our arsenal and you’ll be hearing a lot more about it.