※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
※「routes」内のhelo.js var express = require('express'); var router = express.Router(); /* GET helo page. */ router.get('/', function(req, res, next) { res.render('helo', { title: 'Helo', data: { '太郎':'taro@yamada', '花子':'hanako@flower', 'つやの':'syoda@tuyano.com' } }); }); module.exports = router; ※「views」内のhelo.ejs <!DOCTYPE html> <html> <head> <title><%= title %></title> <link rel='stylesheet' href='/stylesheets/style.css' /> </head> <body> <h1><%= title %></h1> <table> <% for(var key in data){ %> <tr><td><%= key %></td> <td><%= data[key] %></td></tr> <% } %> </table> </body> </html> ※app.jsの追記する文 // 冒頭のrequire文のところに以下を追記 var helo = require('./routes/helo'); // app.use文のところに以下を追記 app.use('/helo', helo); ※「public」内の「stylesheets」内にあるstyle.cssに以下を追記 table tr td{ background-color:#eeeeff; padding: 3px; }
<< 前へ |