Tip

helper.js를 연결한건 app.js에서 일어난 일이다.

app.use((req, res, next) => {
  res.locals.h = helpers;
  res.locals.flashes = req.flash();
  res.locals.user = req.user || null;
  res.locals.currentPath = req.path;
  next();
});

처음에 router 연습해보기

router.get('/', (req, res) => {
  const wes = { name: 'wes', age: 100, cool: true};
  // res.send('Hey! It works!');
  // res.json(wes);
  // res.send(req.query.name);
  // app의 26번째 27번째 줄과 관련있다.
  // res.json(req.query);

  // 1. it needs a name of a template to render out.
  // App의 20번째 21번째 줄 때문에 가능하다.
  res.render('hello', {
    name: 'wes',
    dog: req.query.dog,
    title: 'I love food',
  });
});

set cookie

mixin

views/editStore.pug

mixin/_storeForm.pug

Last updated