{"id":3623,"date":"2016-09-28T10:00:42","date_gmt":"2016-09-28T01:00:42","guid":{"rendered":"http:\/\/sitest.jp\/blog\/?p=3623"},"modified":"2016-12-06T20:06:13","modified_gmt":"2016-12-06T11:06:13","slug":"node-js%e3%81%ae%e6%ac%a1%e4%b8%96%e4%bb%a3web%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%80%8ckoa%e3%80%8d%e3%81%a8%e3%81%af%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/sitest.jp\/blog\/?p=3623","title":{"rendered":"Node.js\u306e\u6b21\u4e16\u4ee3Web\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u300ckoa\u300d\u3068\u306f\uff1f"},"content":{"rendered":"<p>\u7686\u3055\u3093\u306fNode.js\u3067\u304a\u4ed5\u4e8b\u3055\u308c\u3066\u3044\u307e\u3059\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u65e5\u672c\u3067\u306f\u307e\u3060\u307e\u3060\u5c11\u306a\u3044\u3088\u3046\u3067\u3059\u304c\u3001NASA\u306eOSS\u3067\u3082\u63a1\u7528\u3055\u308c\u3066\u3044\u305f\u308a\u3001\u51e6\u7406\u3082\u304b\u306a\u308a\u65e9\u3044\u306e\u3067\u30aa\u30b9\u30b9\u30e1\u3067\u3059\u3057\u3001\u5f0a\u793e\u306e\u30d7\u30ed\u30c0\u30af\u30c8\u3067\u306f\u7a4d\u6975\u7684\u306b\u63a1\u7528\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>Node.js\u306eWeb\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u3044\u3048\u3070<br \/>\n<a href=\"https:\/\/expressjs.com\/\" title=\"express\" target=\"_blank\" rel=\"nofollow\">express<\/a>\u304c\u30c7\u30d5\u30a1\u30af\u30c8\u3068\u306a\u308a\u3064\u3064\u3042\u308a\u3001\u5f0a\u793e\u306e\u30d7\u30ed\u30c0\u30af\u30c8\u3082\u5927\u534a\u306fexpress\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306fexpress\u306e\u958b\u767a\u30c1\u30fc\u30e0\u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u305f\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u300ckoa\u300d\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">koa\u3068\u306f\uff1f<\/h3>\n<\/div>\n<p>Koa is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs. Through leveraging generators Koa allows you to ditch callbacks and greatly increase error-handling. Koa does not bundle any middleware within core, and provides an elegant suite of methods that make writing servers fast and enjoyable.\uff08<a href=\"http:\/\/koajs.com\/#introduction\">\u516c\u5f0f\u30b5\u30a4\u30c8 #Introduction<\/a>\uff09<\/p>\n<p style=\"margin-bottom: 1em\">&nbsp;<\/p>\n<p>Koa\u306f\u3001express\u306e\u958b\u767a\u30c1\u30fc\u30e0\u306b\u3088\u3063\u3066\u8a2d\u8a08\u3055\u308c\u305f\u8efd\u91cf\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3001generator\u3092\u4f7f\u3046\u3053\u3068\u3067\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u5730\u7344\u306b\u9665\u3089\u306a\u3044\u3088\u3046\u306b\u8a2d\u8a08\u3055\u308c\u3066\u3044\u308b\u6b21\u4e16\u4ee3\u306eNode.js\u7528Web\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u306e\u3053\u3068\u3067\u3059\u3002<br \/>\n\u591a\u5f69\u306a\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u305d\u308c\u3089\u3092\u9023\u643a\u3055\u305b\u308b\u3053\u3068\u306b\u3088\u308a\u7c21\u5358\u306b\u697d\u3057\u304f\u30b3\u30fc\u30c9\u3092\u7d44\u307f\u4e0a\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p style=\"margin-bottom: 1em\">&nbsp;<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<\/div>\n<p>Koa\u306fNode.js\u306e\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u52d5\u4f5c\u3057\u307e\u3059\u304c\u3001<br \/>\n0.11.x\u3092\u4f7f\u7528\u3057\u305f\u3044\u5834\u5408\u306f <code>--harmony<\/code> \u3082\u3057\u304f\u306f <code>--harmony-generators flag<\/code> \u3000\u304c\u5fc5\u8981\u3068\u306e\u3053\u3068\u3002<\/p>\n<p>\u3042\u3068\u306f npm \u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u301c\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>$ npm install koa\n$ node app.js\n<\/code><\/pre>\n<p>npm \u3063\u3066\u672c\u5f53\u306b\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p style=\"margin-bottom: 1em\">&nbsp;<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">HelloWorld<\/h3>\n<\/div>\n<p>\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066Hello World\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\nkoa\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b <code>app.js<\/code> \u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u308a\u307e\u3057\u3087\u3046\u3002\u4e2d\u8eab\u306f\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u307e\u3059\u3002<\/p>\n<pre><code>var koa = require('koa');\nvar app = koa();\n\napp.use(function *(){\n  this.body = 'Hello World';\n});\n\napp.listen(3000);\n<\/code><\/pre>\n<p>Node\u30b3\u30de\u30f3\u30c9\u3067app.js\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code>$ node app.js\n<\/code><\/pre>\n<p>\u30d6\u30e9\u30a6\u30b6\u3092\u958b\u3044\u3066<code>http:\/\/localhost:3000<\/code> \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308c\u3070\u300cHello World\u300d\u3068\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" src=\"https:\/\/storage.googleapis.com\/sitest-wp\/blog\/wp-content\/uploads\/2016\/08\/hello_world.png\" alt=\"hello_world\" width=\"682\" height=\"359\" class=\"alignleft size-full wp-image-3633\" border=\"1\" \/><\/p>\n<p>\u305f\u3063\u305f6\u884c\u3067\u3057\u305f\u306d\u3002\u7c21\u5358\u3002<\/p>\n<p style=\"margin-bottom: 1em\">&nbsp;<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\n\u307e\u3068\u3081<\/h3>\n<\/div>\n<p>express\u3068\u306f\u7570\u306a\u308a\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306b\u7d30\u304b\u304f\u5206\u89e3\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u958b\u767a\u304c\u304b\u306a\u308a\u697d\u3057\u3044\u305d\u3046\u3067\u3059\u3002<br \/>\n\u51fa\u6765\u4e0a\u304c\u3063\u305f\u30b3\u30fc\u30c9\u3082\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u5730\u7344\u306b\u306a\u3089\u305a\u3001\u898b\u901a\u3057\u304c\u3044\u3044\u30e2\u30ce\u306b\u306a\u308b\u306e\u3067\u3042\u308c\u3070\u3001\u76ee\u7684\u306b\u3088\u3063\u3066\u306f\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u9078\u5b9a\u306e\u9078\u629e\u80a2\u306b\u3044\u308c\u3066\u3082\u826f\u3044\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p style=\"margin-bottom: 1em\">&nbsp;<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u304a\u307e\u3051<\/h3>\n<\/div>\n<p>\u25c6\u793e\u5185\u3067\u63a1\u7528\u3057\u3066\u3044\u308bAltJS\u300c LiveScript \u300d\u3067HelloWorld<\/p>\n<p>\u4e0a\u8a18\u306eHello World\u306e\u30b3\u30fc\u30c9\u3092\u5f0a\u793e\u3067\u63a1\u7528\u3057\u3066\u3044\u308bAltJS\u3000\u300c<a href=\"http:\/\/livescript.net\" target=\"_blank\" rel=\"nofollow\">LiveScript<\/a>\u300d\u3067\u66f8\u3044\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre><code>require! &lt;[koa]&gt;\napp = koa!\n\napp.use -&gt;*\n  @.body = 'Hello World'\n\napp.listen 3000\n<\/code><\/pre>\n<p>\u304b\u306a\u308a\u898b\u305f\u76ee\u304c\u304b\u306a\u308a\u30b9\u30c3\u30ad\u30ea\u3057\u305f\u3068\u601d\u3044\u307e\u305b\u3093\u304b\uff1f<br \/>\nLiveScript\u306e\u8a73\u7d30\u306f\u5225\u306e\u30b9\u30bf\u30c3\u30d5\u304c<a href=\"http:\/\/sitest.jp\/blog\/?p=2948\" title=\"\u8a18\u4e8b\" >\u3053\u3061\u3089\u306e\u8a18\u4e8b<\/a>\u3067\u7d39\u4ecb\u3057\u3066\u307e\u3059\u3002<br \/>\nHaskell\u30e9\u30a4\u30af\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u3001\u95a2\u6570\u578b\u8a00\u8a9e\u3068\u3057\u3066\u3082\u9762\u767d\u3044\u3067\u3059\u3088\u3002<\/p>\n<p>\u305d\u3093\u306aLiveScript\u3067\u4ed5\u4e8b\u3057\u3066\u307f\u305f\u3044\u3068\u3044\u3046\u65b9\uff01<br \/>\n\u7d76\u8cdb\u52df\u96c6\u3057\u3066\u304a\u308a\u307e\u3059\u306e\u3067<a href=\"https:\/\/www.glad-cube.com\/recruit\/sitest.html\" title=\"\u63a1\u7528\u30da\u30fc\u30b8\" target=\"_blank\">\u63a1\u7528\u30da\u30fc\u30b8<\/a>\u3088\u308a\u30a8\u30f3\u30c8\u30ea\u30fc\u304a\u5f85\u3061\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u53c2\u8003\u30fb\u5f15\u7528<\/h3>\n<\/div>\n<p>http:\/\/koajs.com\/<br \/>\nhttps:\/\/expressjs.com\/<br \/>\nhttp:\/\/livescript.net\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7686\u3055\u3093\u306fNode.js\u3067\u304a\u4ed5\u4e8b\u3055\u308c\u3066\u3044\u307e\u3059\u3067\u3057\u3087\u3046\u304b\u3002 \u65e5\u672c\u3067\u306f\u307e\u3060\u307e\u3060\u5c11\u306a\u3044\u3088\u3046\u3067\u3059\u304c\u3001NASA\u306eOSS\u3067\u3082\u63a1\u7528\u3055\u308c\u3066\u3044\u305f\u308a\u3001\u51e6\u7406\u3082\u304b\u306a\u308a\u65e9\u3044\u306e\u3067\u30aa\u30b9\u30b9\u30e1\u3067\u3059\u3057\u3001\u5f0a\u793e\u306e\u30d7\u30ed\u30c0\u30af\u30c8\u3067\u306f\u7a4d\u6975\u7684\u306b\u63a1\u7528\u3057\u3066\u304a\u308a\u307e\u3059\u3002 Node.js\u306eWeb\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u3044\u3048\u3070 express\u304c\u30c7\u30d5\u30a1\u30af\u30c8\u3068\u306a\u308a\u3064\u3064\u3042\u308a\u3001\u5f0a\u793e\u306e\u30d7\u30ed\u30c0\u30af\u30c8\u3082\u5927\u534a\u306fexpress\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002 \u4eca\u56de\u306fexpress\u306e\u958b\u767a\u30c1\u30fc\u30e0\u306b\u3088\u3063\u3066\u958b\u767a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3669,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[37,27],"tags":[],"acf":false,"_links":{"self":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/3623"}],"collection":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/comments?post=3623"}],"version-history":[{"count":14,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/3623\/revisions"}],"predecessor-version":[{"id":7009,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/3623\/revisions\/7009"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media\/3669"}],"wp:attachment":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media?parent=3623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/categories?post=3623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/tags?post=3623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}