{"id":1952,"date":"2023-07-27T13:24:13","date_gmt":"2023-07-27T04:24:13","guid":{"rendered":"https:\/\/oidema-jp.com\/media\/?p=1952"},"modified":"2023-07-27T13:42:09","modified_gmt":"2023-07-27T04:42:09","slug":"nuxt3%e3%81%aespa%e3%83%a2%e3%83%bc%e3%83%89%e3%81%a7querystring%e3%81%8c%e5%88%a9%e7%94%a8%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%84%e5%95%8f%e9%a1%8c%e3%81%ae%e5%af%be%e5%87%a6%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/oidema-jp.com\/media\/nuxt3%e3%81%aespa%e3%83%a2%e3%83%bc%e3%83%89%e3%81%a7querystring%e3%81%8c%e5%88%a9%e7%94%a8%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%84%e5%95%8f%e9%a1%8c%e3%81%ae%e5%af%be%e5%87%a6%e6%96%b9%e6%b3%95\/","title":{"rendered":"Nuxt3\u306eSPA\u30e2\u30fc\u30c9\u3067querystring\u304c\u5229\u7528\u3067\u304d\u306a\u3044\u554f\u984c\u306e\u5bfe\u51e6\u65b9\u6cd5"},"content":{"rendered":"\n<p>Node.js\u306b\u304a\u3044\u3066<code>Content-Type:application\/x-www-form-urlencoded<\/code>\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u5834\u5408\u306f\u3001body\u60c5\u5831\u306f\u4e00\u822c\u7684\u306b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306bquerystring\u3092\u5229\u7528\u3057\u3066\u51e6\u7406\u3059\u308b\u306e\u304c\u4e00\u822c\u7684\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nimport qs from 'querystring';\n\nconst response = await fetch(url, {\n\u3000method: \"POST\",\n\u3000headers: {\n\u3000\u3000'Content-Type': 'application\/x-www-form-urlencoded'\n\u3000},\n\u3000body: qs.stringify(requestBody)\n});\n<\/pre><\/div>\n\n\n<p>\u3057\u304b\u3057\u306a\u304c\u3089\u4e0a\u8a18\u306e\u3088\u3046\u306a\u30bd\u30fc\u30b9\u3060\u3068Nuxt3\u306eSPA\u30e2\u30fc\u30c9\u3067\u306f\u30a8\u30e9\u30fc\u306b\u906d\u9047\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-0\">\u30a8\u30e9\u30fc\u5185\u5bb9<\/h2>\n\n\n\n<div class=\"wp-block-sgb-codebox pre_tag\"><span><i class=\"fa fa-code\"><\/i><\/span><pre><code>message: \"Module \"querystring\" has been externalized for browser compatibility. Cannot access \"querystring, stringify' in client code. See http:\/\/vitejs.dev\/guide\/troubleshooting.html#\/module-externalized-for-browser-compatibility for more details.\" <\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u554f\u984c\u306f\u201dquerystring\u201d \u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\uff08Node.js\uff09\u3067\u4f7f\u3046\u3082\u306e\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u30b5\u30a4\u30c9\u3067\u52d5\u304b\u306a\u3044\u3053\u3068\u304c\u539f\u56e0\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-1\">\u89e3\u6c7a\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u3053\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u65b9\u6cd5\u306f\u3001<a href=\"https:\/\/www.npmjs.com\/package\/query-string\" target=\"_blank\" rel=\"noopener\" title=\"\">query-string<\/a>\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u89e3\u6c7a\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306bquery-string\u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nnpm install query-string\n<\/pre><\/div>\n\n\n<p>\u6b21\u306bquerystring\u306e\u4ed5\u69d8\u3067\u66f8\u304b\u308c\u3066\u3044\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nimport queryString from 'query-string';\n\nconst response = await fetch(url, {\n\u3000method: \"POST\",\n\u3000headers: {\n\u3000\u3000'Content-Type': 'application\/x-www-form-urlencoded'\n\u3000},\n\u3000body: queryString.stringify(requestBody)\n});\n<\/pre><\/div>\n\n\n<p>\u3053\u308c\u3067\u554f\u984c\u306f\u89e3\u6c7a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>Nuxt3 SPA\u3067<code><code>Content-Type:application\/x-www-form-urlencoded<\/code><\/code>\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3059\u308b\u65b9\u306f\u3053\u3061\u3089\u3092\u53c2\u8003\u306b\u30c7\u30d0\u30c3\u30b0\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node.js\u306b\u304a\u3044\u3066Content-Type:application\/x-www-form-urlencoded\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u5834\u5408\u306f\u3001body\u60c5\u5831\u306f\u4e00\u822c\u7684\u306b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306bquerystring\u3092\u5229\u7528\u3057\u3066\u51e6\u7406\u3059\u308b\u306e\u304c\u4e00 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1953,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"om_disable_all_campaigns":false,"footnotes":""},"categories":[40],"tags":[],"class_list":{"0":"post-1952","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-40","8":"entry"},"acf":[],"aioseo_notices":[],"mb":[],"mfb_rest_fields":["title","aioseo_notices"],"_links":{"self":[{"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/posts\/1952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/comments?post=1952"}],"version-history":[{"count":6,"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/posts\/1952\/revisions"}],"predecessor-version":[{"id":1960,"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/posts\/1952\/revisions\/1960"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/media\/1953"}],"wp:attachment":[{"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/media?parent=1952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/categories?post=1952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oidema-jp.com\/media\/wp-json\/wp\/v2\/tags?post=1952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}