{"id":105,"date":"2026-05-29T12:43:30","date_gmt":"2026-05-29T03:43:30","guid":{"rendered":"http:\/\/localhost\/miyasaka\/blog\/?p=105"},"modified":"2026-06-11T09:14:42","modified_gmt":"2026-06-11T00:14:42","slug":"node-js%e3%81%a7%e7%b0%a1%e5%8d%98%e3%81%aaapi%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%82%92%e4%bd%9c%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/2026\/05\/29\/node-js%e3%81%a7%e7%b0%a1%e5%8d%98%e3%81%aaapi%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%82%92%e4%bd%9c%e3%82%8b%e6%96%b9%e6%b3%95\/","title":{"rendered":"Node.js\u3067\u7c21\u5358\u306aAPI\u30b5\u30fc\u30d0\u30fc\u3092\u4f5c\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>Node.js\u3067\u306f <code>Express<\/code> \u3092\u4f7f\u3046\u3053\u3068\u3067\u7c21\u5358\u306bAPI\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Express\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n\n\n\n<pre><code class=\"language-bash\">npm install express<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"4896\" height=\"3188\" data-id=\"99\" src=\"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-content\/uploads\/2026\/05\/peanuts.jpg\" alt=\"\" class=\"wp-image-99\"\/><\/figure>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b5\u30fc\u30d0\u30fc\u3092\u4f5c\u6210<\/h2>\n\n\n\n<pre><code class=\"language-js\">\nconst express = require('express');\n\nconst app = express();\n\napp.get('\/', (req, res) => {\n    res.send('Hello World');\n});\n\napp.listen(3000, () => {\n    console.log('Server Start');\n});\n<\/code><\/pre>\n\n\n\n<p>\u30d6\u30e9\u30a6\u30b6\u3067 <code>http:\/\/localhost:3000<\/code> \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">JSON\u3092\u8fd4\u3059<\/h2>\n\n\n\n<p>API\u3067\u306fJSON\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u8fd4\u3059\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<pre><code class=\"language-js\">app.get('\/api\/user', (req, res) => {\n\n    res.json({\n        name: 'Taro',\n        age: 20\n    });\n\n});<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"6048\" height=\"4024\" data-id=\"96\" src=\"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-content\/uploads\/2026\/05\/jamWithBread.jpg\" alt=\"\" class=\"wp-image-96\"\/><\/figure>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">POST\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b<\/h2>\n\n\n\n<pre><code class=\"language-js\">app.use(express.json());\n\napp.post('\/api\/post', (req, res) => {\n\n    console.log(req.body);\n\n    res.json({\n        status: 'success'\n    });\n\n});<\/code><\/pre>\n\n\n\n<p>\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3068\u306e\u9023\u643a\u3067\u983b\u7e41\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node.js\u3067\u306f Express \u3092\u4f7f\u3046\u3053\u3068\u3067\u7c21\u5358\u306bAPI\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002 Express\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb npm install express \u30b5\u30fc\u30d0\u30fc\u3092\u4f5c\u6210 const express = require(&#8216;exp &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/2026\/05\/29\/node-js%e3%81%a7%e7%b0%a1%e5%8d%98%e3%81%aaapi%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%82%92%e4%bd%9c%e3%82%8b%e6%96%b9%e6%b3%95\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Node.js\u3067\u7c21\u5358\u306aAPI\u30b5\u30fc\u30d0\u30fc\u3092\u4f5c\u308b\u65b9\u6cd5&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,7],"tags":[15,13,14,5],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-code","category-programming","tag-api","tag-javascript","tag-node","tag-programming"],"_links":{"self":[{"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":12,"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":910,"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/posts\/105\/revisions\/910"}],"wp:attachment":[{"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mm-watchpoint.site\/miyasaka\/blog\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}