Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Build Node.js APIs Using Serverless

49 vues

Publié le

Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/2xMH5jr.

Simona Cotin talks about how to migrate an API of an existing app to Azure Functions, and how to use Visual Studio Code and the Azure Functions extension to speed up work. Filmed at qconlondon.com.

Simona Cotin is Cloud Developer Advocate at Microsoft. She spends most of her time tinkering with JavaScript in the cloud and sharing her experience with other developers at events. She engages with the web community to help create a great developer experience with Azure, loves shipping code to production and has built network data analytics platforms using Angular, Typescript, React, and Node.

Publié dans : Technologie
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Build Node.js APIs Using Serverless

  1. 1. Build Scalable APIs using GraphQL and Serverless
  2. 2. InfoQ.com: News & Community Site Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ serverless-nodejs-api/ • Over 1,000,000 software developers, architects and CTOs read the site world- wide every month • 250,000 senior developers subscribe to our weekly newsletter • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • 2 dedicated podcast channels: The InfoQ Podcast, with a focus on Architecture and The Engineering Culture Podcast, with a focus on building • 96 deep dives on innovative topics packed as downloadable emags and minibooks • Over 40 new content items per week
  3. 3. Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide Presented at QCon London www.qconlondon.com
  4. 4. @simona_cotin
  5. 5. @simona_cotin
  6. 6. @simona_cotin
  7. 7. @simona_cotin JS
  8. 8. @simona_cotin
  9. 9. @simona_cotin
  10. 10. @simona_cotin
  11. 11. @simona_cotin –-Lee Byron a data-fetching API powerful enough to describe all of Facebook
  12. 12. @simona_cotin
  13. 13. @simona_cotin https://facebook.com/user/id https://facebook.com/user/id/events https://facebook.com/user/id/friends-suggestions https://facebook.com/user/id/friends-birthdays
  14. 14. @simona_cotin https://facebook.com/user/id/events { "name": “ServerlessDays", "location": "Cardiff", "organiser": "Matt", "attendees": [ { "name": “Ant Stanley", "company": "!", "role": “Father of ServerlessDays” } ] }
  15. 15. @simona_cotin
  16. 16. @simona_cotin Overfetch Or New endpoint
  17. 17. @simona_cotin
  18. 18. @simona_cotin https://facebook.com/user/id/friends-suggestions { "name": "Golnaz Badazadeh", "profile_pic": "some_url", "mutual_friends": [] }
  19. 19. @simona_cotin https://facebook.com/user/id/friends-suggestions/id/mutual { "mutual_friends": [ { "name": "Sarah Drasner", "profile_pic": "some_url", "tag": "Amazing!" } ] }
  20. 20. @simona_cotin Underfetch Or New endpoint
  21. 21. @simona_cotin Delay User Perception 0-100 ms Instant 100-300 ms Small perceptible delay 300-1000 ms Machine is working 1000+ ms Likely context switch 10000+ ms Task is abandoned High performance Browser Networking
  22. 22. @simona_cotin –-Ilya Grigorik The fastest network request is a request not made
  23. 23. @simona_cotin query { user(id:1) { name events { count } friends_suggestions { name mutual_friends { count } } } } { "data": { "user": { "name": "Simona Cotin", "events": { "count": 4 }, "friends_suggestions": { "name": "Golnaz Babazadeh", "mutual_friends": { "count": 15 } } } } }
  24. 24. @simona_cotin Schema driven development
  25. 25. @simona_cotin Strongly typed
  26. 26. @simona_cotin type People { id: ID! name: String avatar: URL }
  27. 27. @simona_cotin type People { id: ID! name: String avatar: URL } type Team { id: ID! name: String points: Int people: [People] }
  28. 28. @simona_cotin type Query { teams: [Team] } type Mutation { incrementPoints(id: ID!): Team }
  29. 29. @simona_cotin const root = { teams: async () =>" { let teams = await axios.get( 'https://graphqlvoting.azurewebsites.net/ api/score' ); return teams.data; }, incrementPoints: async obj =>" { let response = await axios.get( `https://graphqlvoting.azurewebsites.net/ api/score/${obj.id}` ); return response.data; } };
  30. 30. @simona_cotin
  31. 31. @simona_cotin
  32. 32. @simona_cotin
  33. 33. @simona_cotin ✓ Performance ✓ Flexibility ✓ Tooling
  34. 34. @simona_cotin Serverless
  35. 35. @simona_cotin –-Steve Jobs The line of code that’s the fastest to write, that never breaks, that doesn’t need maintenance, is the line you never had to write.
  36. 36. @simona_cotin module.exports = async function(context, req) { context.res = { body: 'Hello ' + req.query.name }; };
  37. 37. @simona_cotin Right-Click Deploy
  38. 38. @simona_cotin Github Deploy
  39. 39. @simona_cotin
  40. 40. @simona_cotin Datasources 3rd party APIs
  41. 41. @simona_cotin
  42. 42. @simona_cotin { "type": "cosmosDB", "name": "inputDocument", "databaseName": "admin", "collectionName": "Recipes", "connectionStringSetting": "tacos-sql_DOCUMENTDB", “direction": "in" }
  43. 43. @simona_cotin module.exports = async function(context, req) { context.res = { body: context.bindings.inputDocument }; };
  44. 44. @simona_cotin ✓ Reusable API ✓ VS Code dev & debug ✓ Easy Integration Datasources
  45. 45. @simona_cotin No servers to manage
  46. 46. @simona_cotin Serverless
  47. 47. @simona_cotin
  48. 48. @simona_cotin
  49. 49. @simona_cotin
  50. 50. @simona_cotin
  51. 51. @simona_cotin
  52. 52. @simona_cotin module.exports = async function(context, req) { const body = req.body; let response = await graphql( typeDefs, body.query, root, null, body.variables, body.operationName ); context.res = { body: response }; };
  53. 53. @simona_cotin
  54. 54. @simona_cotin
  55. 55. @simona_cotin
  56. 56. @simona_cotin
  57. 57. @simona_cotin Easy Integration of Datasources Autoscalability Less code Easy Abstraction of Datasources Single Endpoint Smaller no requests Serverless GraphQL
  58. 58. @simona_cotin Easy Integration of Datasources Easy Abstraction of Datasources Autoscalability Single Endpoint Less code Smaller no requests Dev productivity
  59. 59. @simona_cotin Achieve more by doing less
  60. 60. @simona_cotin https://github.com/simonaco/serverless- graphql-workshop
  61. 61. Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ serverless-nodejs-api/

×