Upgrade to Pro — share decks privately, control downloads, hide ads and more …

fastifyはいいぞ

ykmikan
February 27, 2018
1.9k

 fastifyはいいぞ

ykmikan

February 27, 2018
Tweet

Transcript

  1. fastify ❖ pinoͷ੡࡞ऀ͕࡞ͬͨ web framework ❖ Φʔόʔϔου͕খ͍͞ ❖ inspired by

    hapi, express ❖ express΍Restifyޓ׵ͷϛυ ϧ΢ΣΞΛαϙʔτ ❖ validationͱserialize͕͋Δ ❖ ࠷ۙ v1.0ͷrc൛͕ग़ͨ
  2. validation & serialization ❖ ajv 
 The fastest JSON Schema

    validator for Node.js and browser. Supports draft-04/06/07. jsͰ͔͚Δ!! swaggerΑΓॻ͖΍͍͢!!
  3. Express vs Koa vs Fastify ❖ ࡞੒ͨ͠API ❖ apiͷpath
 /api/sample/hello

    ❖ Query string ❖ userName, greeting ❖ Response ❖ Message: `${userName}, ${greeting}`
  4. Express vs Koa vs Fastify ❖ ࣮ߦ؀ڥ ❖ node: v8.3.0

    ❖ mac book pro i7, 16GB ❖ ࣮ߦίϚϯυ
 autocannon -c 100 -d 40 -p 10 “http://localhost:3011/api/sample/hello?userName=test&greeting=hello" Framework Version Router Version Express v4.16.2 Default - Koa v2.5.0 Koa-router v7.4.0 Fastify v1.0.0-rc2 Default
 (find-my-way) v1.10.1
  5. ଌఆ݁Ռ express koa fastify Latency 8.38 ms 8.26 ms 5.18

    ms Req/Sec 11758.25 11978.85 18954.41 Bytes/Sec 2.8 MB 2.8 MB 2.96 MB ❖ autocannon -c 100 -d 40 -p 10 “http://localhost:3011/api/sample/hello? userName=test&greeting=hello"