Elastic APIs: Are microservices the answer? by ...

Elastic APIs: Are microservices the answer? by Orlando Kalossakas

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

32 slides
  1. Microservices Everyone is talking about this topic, everyone is trying

    to take a bite.
 P.S. They have their own instagram.com/microservices account
  2. Containers are A THING • Have been around since `chroot`

    • Became a global trend shortly after the release of Docker the 2013-03-23
  3. Qualities of microservices • Deal with problems inside their scope

    • Data sharing per service • Available • Versioning • Auto-deployable
  4. //Assume you have an .env file
 var express = require('express');

    var http = require('http'); var mongo = require('mongodb').MongoClient; var app = express(); app.set('port', process.env.PORT || 8080); var mongodb; if(process.env.MONGO_URL) { mongo.connect(process.env.MONGO_URL, null, function(err, mongodb_) { if(err) { console.log(err); } else { mongodb = mongodb_; } }); } app.get('/users', function(req, res, next) { var collection = db.collection('users'); collection.find().toArray(function(err, result) { if(err) { res.sendStatus(500); return; } res.json(result); }); }); app.listen(app.get('port')); Retrieve all users
  5. λ

  6. λ!

  7. • Own code + Libraries • Native SDK • Timeouts

    and Memory • Use external storage, there’s no root access! • Debug via cloudwatch
  8. λ G
 A
 T
 E
 W
 A
 Y /route λ

    λ λ λ GET PUT POST DELETE PATCH
  9. console.log('Loading function'); exports.handler = function(event, context) { //YOUR CODE GOES

    HERE context.succeed(“Hurray”); context.fail(‘oh no :( :(‘); };
  10. swagger: '2.0' info: version: '1.0.0' title: Swagger Petstore description: A

    sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification termsOfService: http://helloreverb.com/terms/ contact: name: Swagger API team email: [email protected]
  11. – (Maybe) A guy employed by Amazon who worked on

    Lambda It’s Superfast, like Rambo driving a Lambo TEST IT: squirrelbin.com

More Decks by API Strategy & Practice Conference

Other Decks in Technology