robin*

메인 판 목록 추가

1 const app = require('../server'); 1 const app = require('../server');
2 const db = require('../db'); 2 const db = require('../db');
3 3
4 -app.get('/board', async(req, res) => { 4 +app.get('/', async(req, res) => {
5 - res.json({boards: await db.get('board').find()}); 5 + res.render('boardlist', {boards: await db.get('board').find()});
6 }) 6 })
7 app.get('/board/:bid', async(req, res) => { 7 app.get('/board/:bid', async(req, res) => {
8 let board = await db.get('board').findOne({name: req.params.bid}); 8 let board = await db.get('board').findOne({name: req.params.bid});
......
1 +<div class="list-group">
2 + {{#each boards}}
3 + <a href="/board/{{this.name}}" class="list-group-item list-group-item-action">{{this.title}}</a>
4 + {{/each}}
5 +</div>
...\ No newline at end of file ...\ No newline at end of file