{"id":5858,"date":"2020-02-18T02:50:29","date_gmt":"2020-02-17T17:50:29","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=5858"},"modified":"2020-02-18T02:50:29","modified_gmt":"2020-02-17T17:50:29","slug":"express%e3%81%a7db%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e3%82%a8%e3%82%af%e3%82%b9%e3%83%9d%e3%83%bc%e3%83%88%ef%bc%86%e3%82%a4%e3%83%b3%e3%83%9d%e3%83%bc%e3%83%88","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=5858","title":{"rendered":"Express\u3067DB\u30c7\u30fc\u30bf\u3092\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\uff06\u30a4\u30f3\u30dd\u30fc\u30c8"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u306f<code>Node.js<\/code>\uff08<code>Express<\/code>\uff09\u306e\u300c<strong>\u306a\u304f\u3066\u3082\u3044\u3044\u3051\u3069\u3001\u3042\u308c\u3070\u5b09\u3057\u3044\u3088\u306d<\/strong>\u300d\u6a5f\u80fd\u3068\u3057\u3066\u3001\u300c<a href=\"https:\/\/blog.capilano-fw.com\/?p=5839\">Node.js\u3067Twitter\u306b\u6295\u7a3f\u3059\u308b<\/a>\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3092\u304a\u5c4a\u3051\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u4eca\u56de\u306f\u305d\u306e\u7b2c\uff12\u5f3e\u3068\u3057\u3066\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">DB\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\uff06\u30a4\u30f3\u30dd\u30fc\u30c8\u6a5f\u80fd\u00a0<\/strong><\/p>\n<p>\u3092\u3054\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u7279\u306b\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u306f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3055\u3093\u306b\u3088\u3063\u3066\u306f\u5fc5\u9808\u6a5f\u80fd\u3068\u8003\u3048\u3066\u3044\u308b\u65b9\u3082\u3044\u3089\u3063\u3057\u3083\u308b\u3050\u3089\u3044\u3001\u3042\u308c\u3070\u7d50\u69cb\u91cd\u5b9d\u3059\u308b\u6a5f\u80fd\u3067\u3059\u3057\u3001\u3001\u30a4\u30f3\u30dd\u30fc\u30c8\u306f\u30b5\u30a4\u30c8\u958b\u8a2d\u6642\u306b\u5225\u7ba1\u7406\u3057\u3066\u3044\u305f\u30c7\u30fc\u30bf\u3092\u79fb\u884c\u3059\u308b\u306e\u306b\u4fbf\u5229\u306a\u306e\u3067\u3001\u3053\u3061\u3089\u3082\u540c\u69d8\u306b\u3082\u3064\u3051\u3066\u958b\u767a\u3092\u3057\u3066\u307f\u307e\u3057\u305f\u3002\uff08\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u6a5f\u80fd\u3064\u304d\u3067\u3059\u2728\uff09<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3405 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png\" alt=\"\" width=\"310\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png 310w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18-291x300.png 291w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/p>\n<p><strong>\u958b\u767a\u5b8c\u4e86\uff1a<\/strong> Node.js 8\u3001Express 4.1<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u4eca\u56de\u3054\u7d39\u4ecb\u3059\u308b\u5185\u5bb9\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u64cd\u4f5c\u306b<a href=\"https:\/\/sequelize.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sequelize<\/a>\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u3082\u3057<code>Sequlize<\/code>\u3092\u4f7f\u3044\u305f\u3044\u5834\u5408\u306f\u4ee5\u4e0b\uff12\u3064\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.capilano-fw.com\/?p=5546\">\u4fbf\u5229\uff01Node.js\u306bDB\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3001Seed\u3001\u30e2\u30c7\u30eb\u3092\u7528\u610f\u3059\u308b\u300cSequelize\u300d<\/a><\/li>\n<li><a href=\"https:\/\/blog.capilano-fw.com\/?p=5582\">\u4fdd\u5b58\u7248\uff01\u300csequelize\u300d\u30e2\u30c7\u30eb\u306e\u4f7f\u3044\u65b9\u5b9f\u4f8b<\/a><\/li>\n<\/ul>\n<p>\u306a\u304a\u3001<code>Sequelize<\/code>\u3092\u4f7f\u308f\u306a\u304f\u3066\u3082\u4eca\u56de\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3059\u308c\u3070\u7c21\u5358\u306bDB\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\uff06\u30a4\u30f3\u30dd\u30fc\u30c8\u304c\u3067\u304d\u308b\u3068\u601d\u3046\u306e\u3067\u3001\u305c\u3072\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<h1>\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p><code>Node.js<\/code>\u3067<code>Excel<\/code>\uff06<code>CSV<\/code>\u3092\u64cd\u4f5c\u3059\u308b\u30d1\u30c3\u30b1\u30fc\u30b8<code>exceljs<\/code>\u3092\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>npm i --save exceljs<\/strong><\/pre>\n<div id=\"export_csv\">\n<pre><strong>npm i --save express-fileupload<\/strong><\/pre>\n<pre><strong>npm i --save validator<\/strong><\/pre>\n<p>\u203b<code>express-fileupload<\/code>\u3068<code>express-validator<\/code>\u306f\u3001\u30a4\u30f3\u30dd\u30fc\u30c8\u6642\u306e\u30d5\u30a1\u30a4\u30eb\u9001\u4fe1\u3068\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3067\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<\/div>\n<h1>\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b<\/h1>\n<h2>CSV\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b<\/h2>\n<pre><strong>const ExcelJS = require('exceljs');<\/strong>\r\n\r\n<strong>app.get('\/export', (req, res) =&gt; {\r\n<\/strong>\r\n  \/\/ DB\u30c7\u30fc\u30bf\u3092\u53d6\u5f97<strong>\r\n  const users = User.findAll()\r\n    .then(users =&gt; {\r\n\r\n      const workbook = new ExcelJS.Workbook();\r\n      const worksheet = workbook.addWorksheet('sheet-name');\r\n<\/strong>\r\n      \/\/ \uff11\u884c\u305a\u3064\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b\u30c7\u30fc\u30bf\u3092\u30bb\u30c3\u30c8<strong>\r\n      users.forEach((user, index) =&gt; {\r\n\r\n        let rowIndex = index + 1;\r\n        worksheet.getRow(rowIndex).values = [\r\n          user.id,\r\n          user.name,\r\n          user.email\r\n        ];\r\n\r\n      });\r\n<\/strong>\r\n      \/\/ CSV\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8<strong>\r\n      workbook.csv.writeBuffer()\r\n        .then(buffer =&gt; {\r\n\r\n          const fileName = 'users.csv';\r\n          res.setHeader('Content-Type', 'text\/csv; charset=UTF-8');\r\n          res.setHeader('Content-disposition', 'attachment; filename='+ fileName);\r\n          res.send(buffer);\r\n\r\n        });\r\n\r\n    });\r\n\r\n});<\/strong><\/pre>\n<h2>Excel\u30d5\u30a1\u30a4\u30eb\uff08xlsx\uff09\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b<\/h2>\n<p>\u300c<a href=\"#export_csv\">CSV\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b<\/a>\u300d\u3068\u307b\u307c\u540c\u3058\u306a\u306e\u3067\u3001<code>workbook.xlsx.writeBuffer()<\/code>\u306e\u90e8\u5206\u3060\u3051\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>\/\/ Excel\u30d5\u30a1\u30a4\u30eb\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\r\nworkbook.xlsx.writeBuffer()\r\n  .then(buffer =&gt; {\r\n\r\n    <strong>const fileName = 'users.xlsx';\r\n    res.setHeader('Content-Type', 'application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet');\r\n    res.setHeader('Content-disposition', 'attachment; filename='+ fileName);\r\n    res.send(buffer);<\/strong>\r\n\r\n  });<\/pre>\n<h1>\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b<\/h1>\n<h2>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u8aad\u307f\u8fbc\u3080<\/h2>\n<p>\u307e\u305a\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3068\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u305f\u3081\u306b\u3001\u5148\u307b\u3069\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u8aad\u307f\u8fbc\u3093\u3067\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>const ExcelJS = require('exceljs');\r\nconst fileUpload = require('express-fileupload');\r\nconst validator = require('validator');<\/strong><\/pre>\n<h2>\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u3092\u8a2d\u5b9a\u3059\u308b<\/h2>\n<p>\u7d9a\u3044\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u30fb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u306e\u305f\u3081\u306b\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>app.use(fileUpload({ useTempFiles: true }));<\/strong><\/pre>\n<p><code>useTempFiles<\/code>\u306f\u3001\u9001\u4fe1\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u6642\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002\u30a4\u30f3\u30dd\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u304c\u697d\u306b\u306a\u308b\u306e\u3067\u3001\u4eca\u56de\u306f\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b\u3082\u3057\u30d5\u30a1\u30a4\u30eb\u3060\u3051\u3067\u306a\u304f\u3001\u901a\u5e38\u306e\u5165\u529b\u3082\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u4ee5\u4e0b\u3082\u540c\u69d8\u306b\u8ffd\u52a0\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>app.use(express.json());\r\napp.use(express.urlencoded({ extended: true }));\r\n<\/strong><\/pre>\n<h2>\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u308b<\/h2>\n<p>\u3067\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u305f\u3081\u306e\u30d5\u30a9\u30fc\u30e0\u3092\u4f5c\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305a\u306f\u30eb\u30fc\u30c8\u3067\u3059\u3002<\/p>\n<pre><strong>app.get('\/import', (req, res) =&gt; {\r\n\r\n  res.render('import');\r\n\r\n});<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001\u30d3\u30e5\u30fc\u3067\u3059\u3002<br \/>\n\u30d1\u30b9\u306f\u3001\u300c<strong>views\/import.mst<\/strong>\u300d\u3067\u3059\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;div id=\"app\"&gt;\r\n    <strong>&lt;input type=\"file\" accept=\".csv, .xlsx\" @change=\"onFileChange\"&gt;\r\n    &lt;br&gt;\r\n    &lt;button type=\"button\" @click=\"onSubmit\"&gt;\u9001\u4fe1\u3059\u308b&lt;\/button&gt;<\/strong>\r\n&lt;\/div&gt;\r\n&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.11\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/0.19.2\/axios.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script&gt;\r\n\r\n    new Vue({\r\n        el: '#app',\r\n        data: {\r\n            importFile: null\r\n        },\r\n        methods: {\r\n            <strong>onFileChange(e) {\r\n\r\n                const files = e.target.files;\r\n\r\n                if(files.length &gt; 0) {\r\n\r\n                    this.importFile = files[0];\r\n\r\n                }\r\n\r\n            },\r\n            onSubmit() {\r\n\r\n                let formData = new FormData();\r\n                formData.append('importFile', this.importFile);\r\n                axios.post('\/import', formData)\r\n                    .then(response =&gt; {\r\n\r\n                        if(response.data.result) {\r\n\r\n                            alert('\u30a4\u30f3\u30dd\u30fc\u30c8\u5b8c\u4e86!');\r\n\r\n                        }\r\n\r\n                    });\r\n\r\n            }<\/strong>\r\n        }\r\n    });\r\n\r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u5b9f\u969b\u306b\u30d6\u30e9\u30a6\u30b6\u3067\u78ba\u8a8d\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5868\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_1.png\" alt=\"\" width=\"262\" height=\"69\" \/><\/p>\n<h2>\u30d5\u30a1\u30a4\u30eb\u3092\u53d7\u4fe1\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u308b<\/h2>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u53d7\u3051\u53d6\u3063\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u8ffd\u52a0\u3059\u308b\u90e8\u5206\u3067\u3059\u3002<br \/>\nCSV\u3001\u30a8\u30af\u30bb\u30eb\u30d5\u30a1\u30a4\u30eb\u3069\u3061\u3089\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>app.post('\/import', (req, res) =&gt; {\r\n\r\n    try {\r\n\r\n        <strong>const workbook = new ExcelJS.Workbook();<\/strong>\r\n<strong>        const importFile = req.files.importFile;<\/strong>\r\n<strong>        const tempFilePath = importFile.tempFilePath;<\/strong>\r\n<strong>        const mimeType = importFile.mimetype;<\/strong>\r\n<strong>        let reader;<\/strong>\r\n\r\n<strong>        if(mimeType === 'text\/csv') {<\/strong>\r\n\r\n<strong>            reader = workbook.csv.readFile(tempFilePath);<\/strong>\r\n\r\n<strong>        } else if(mimeType === 'application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {<\/strong>\r\n\r\n<strong>            reader = workbook.xlsx.readFile(tempFilePath);<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        reader.then(() =&gt; {<\/strong> \/\/ \u30a4\u30f3\u30dd\u30fc\u30c8\r\n\r\n<strong>            const worksheet = workbook.getWorksheet(1);<\/strong>\r\n<strong>            let data = [];<\/strong>\r\n\r\n<strong>            for(let i = 1; i &lt;= worksheet.rowCount; i++) {<\/strong>\r\n\r\n<strong>                const row = worksheet.getRow(i);<\/strong>\r\n<strong>                const name = row.getCell(1).value;<\/strong>\r\n<strong>                const email = row.getCell(2).value;<\/strong>\r\n<strong>                const password = row.getCell(3).value;<\/strong>\r\n\r\n<strong>                if(validator.isEmpty(name) || validator.isEmpty(password) || !validator.isEmail(email)) {<\/strong>\r\n\r\n<strong>                    throw new Error('\u30c7\u30fc\u30bf\u304c\u4e0d\u5b8c\u5168\u306a\u305f\u3081\u51e6\u7406\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002');<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>                data.push({<\/strong>\r\n<strong>                    name: name,<\/strong>\r\n<strong>                    email: email,<\/strong>\r\n<strong>                    password: password,<\/strong>\r\n<strong>                    createdAt: new Date(),<\/strong>\r\n<strong>                    updatedAt: new Date()<\/strong>\r\n<strong>                });<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>            User.bulkCreate(data);<\/strong>\r\n<strong>            res.json({ result: true });<\/strong>\r\n\r\n<strong>        })<\/strong>\r\n<strong>        .catch(error =&gt; {<\/strong>\r\n\r\n<strong>            return res.status(400).send(error.message);<\/strong>\r\n\r\n<strong>        });<\/strong>\r\n\r\n    } catch(error) {\r\n\r\n        return res.status(400).send(error.message);\r\n\r\n    }\r\n\r\n});<\/pre>\n<p>\u30b3\u30fc\u30c9\u306e\u6d41\u308c\u3068\u3057\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u9001\u4fe1\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\uff08\u4e00\u6642\u30d5\u30a1\u30a4\u30eb\uff09\u3092\u8aad\u307f\u8fbc\u3080<\/li>\n<li>\u8aad\u307f\u8fbc\u307e\u308c\u305f\u30c7\u30fc\u30bf\u3092\uff11\u884c\u305a\u3064\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3059\u308b<\/li>\n<li>\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u5168\u3066\u901a\u904e\u3057\u305f\u3089\u30c7\u30fc\u30bf\u3092DB\u306b\u8ffd\u52a0\u3059\u308b<\/li>\n<\/ol>\n<h2>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h2>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a4\u30f3\u30dd\u30fc\u30c8\u3092\u5b9f\u884c\u3057\u3066\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4e8b\u524d\u60c5\u5831\u3068\u3057\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5873\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_2.png\" alt=\"\" width=\"671\" height=\"367\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_2.png 671w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_2-300x164.png 300w\" sizes=\"auto, (max-width: 671px) 100vw, 671px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u3053\u306b\u516d\u90ce\u3055\u3093\u30c7\u30fc\u30bf\u304c\u5165\u3063\u305f\u30a8\u30af\u30bb\u30eb\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5874\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_3.png\" alt=\"\" width=\"501\" height=\"39\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_3.png 501w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_3-300x23.png 300w\" sizes=\"auto, (max-width: 501px) 100vw, 501px\" \/><\/p>\n<p>\u3067\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u629e\u3057\u3066\u9001\u4fe1\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5875\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_4.png\" alt=\"\" width=\"194\" height=\"68\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5876\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_5.png\" alt=\"\" width=\"532\" height=\"183\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_5.png 532w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_5-300x103.png 300w\" sizes=\"auto, (max-width: 532px) 100vw, 532px\" \/><\/p>\n<p>DB\u306e\u65b9\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5877\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_6.png\" alt=\"\" width=\"671\" height=\"388\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_6.png 671w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_6-300x173.png 300w\" sizes=\"auto, (max-width: 671px) 100vw, 671px\" \/><\/p>\n<p>\u516d\u90ce\u3055\u3093\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u308f\u3056\u3068\u9593\u9055\u3048\u3066\u30d5\u30a1\u30a4\u30eb\u9001\u4fe1\u3057\u305f\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u3046\u307e\u304f\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3082\u6a5f\u80fd\u3057\u3066\u3044\u307e\u3059\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5878\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_7.png\" alt=\"\" width=\"419\" height=\"117\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_7.png 419w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/02\/express_import_7-300x84.png 300w\" sizes=\"auto, (max-width: 419px) 100vw, 419px\" \/><\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Express<\/code>\u3092\u4f7f\u3063\u305fDB\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\uff0f\u30a4\u30f3\u30dd\u30fc\u30c8\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u4eca\u56de\u306e\u958b\u767a\u3067\u611f\u3058\u305f\u3053\u3068\u306f\u3001\u300c\u3048\u3063\u3001\u9001\u4fe1\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u5fc5\u8981\u306a\u306e\uff01\uff1f\u300d\u3068\u3044\u3046\u3053\u3068\u3067\u3057\u305f\u3002<\/p>\n<p><code>Express<\/code>\u306f\u5fc5\u8981\u6700\u4f4e\u9650\u306e\u6a5f\u80fd\u306b\u7d5e\u3063\u3066\u3044\u308b\u306e\u3067\u3001<code>Laravel<\/code>\u3067\u306f\u5f53\u305f\u308a\u524d\u306e\u6a5f\u80fd\u304c\u3064\u3044\u3066\u3044\u306a\u304b\u3063\u305f\u308a\u3057\u307e\u3059\u3002\uff08\u306a\u306e\u3067\u3001\u300c\u624b\u306e\u304b\u304b\u308b\u5b50\u4f9b\u307b\u3069\u304b\u308f\u3044\u3044\u300d\u72b6\u614b\u306b\u3082\u306a\u308a\u3084\u3059\u3044\u306e\u3067\u3059\u304c\ud83d\ude09\uff09<\/p>\n<p>\u3068\u306f\u3044\u3048\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u901f\u5ea6\u306f\u8d85\u9ad8\u901f\u306a\u306e\u3067\u3001\u958b\u767a\u3059\u308b\u30b5\u30a4\u30c8\u306b\u3088\u3063\u3066\u9078\u629e\u3092\u3059\u308b\u3068\u3044\u3046\u30b9\u30bf\u30f3\u30b9\u304c\u3044\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u3084\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2596 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/14-2.png\" alt=\"\" width=\"370\" height=\"350\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/14-2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/14-2-300x284.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u306fNode.js\uff08Express\uff09\u306e\u300c\u306a\u304f\u3066\u3082\u3044\u3044\u3051\u3069\u3001\u3042\u308c\u3070\u5b09\u3057\u3044\u3088\u306d\u300d\u6a5f\u80fd\u3068\u3057\u3066\u3001\u300cNode.js\u3067Twitter\u306b\u6295\u7a3f\u3059\u308b\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3092\u304a\u5c4a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=5858\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Express\u3067DB\u30c7\u30fc\u30bf\u3092\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\uff06\u30a4\u30f3\u30dd\u30fc\u30c8&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":5880,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[201],"tags":[137,5],"class_list":["post-5858","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-express","tag-137","tag-5"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5858","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5858"}],"version-history":[{"count":15,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5858\/revisions"}],"predecessor-version":[{"id":10025,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5858\/revisions\/10025"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/5880"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5858"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}