Page 248 - Nodejs 교과서 개정2판
P. 248
քझח ಌӒ )5.- ޙߨ ߸ചী ೞӝ ൨ٚ ࠙ীѱ ೠ మ݁ ূݴ যझܳ ݅ٚ ݽۄ
ীࢲ ٜ݅णפ )5.- ޙߨਸ Ӓ۽ ࢎਊೞغ ୶о۽ ߄झ݀ ޙߨਸ ࢎਊೡ ࣻ Ҋ ॆ మ
݁ ূੋ 5XJH৬ ޙߨ ࢚ ਬࢎפ
քझܳ ࢸפ
콘솔
$ npm i nunjucks
view engineਸ ಌӒ न քझ۽ Үפ
app.js
...
const path = require('path');
const nunjucks = require('nunjucks');
dotenv.config();
const indexRouter = require('./routes');
const userRouter = require('./routes/user');
const app = express();
app.set('port', process.env.PORT || 3000);
app.set('view engine', 'html');
nunjucks.configure('views', {
express: app,
watch: true,
});
app.use(morgan('dev'));
...
ಌӒ৬ח োѾ ߑߨ ࣗ ܵפ configure ߣ૩ ੋࣻ۽ WJFXT ಫ؊ ҃۽ܳ ֍Ҋ ف ߣ૩ ੋࣻ۽
২࣌ਸ ֍णפ ٸ express ࣘࢿী app ёܳ োѾפ watch ২࣌ trueݶ )5.- ੌ ߸҃ؼ
ٸ మ݁ ূਸ द ۪؊݂פ
ੌ ಌӒ৬ э ౠࣻೠ ഛ न IUNMਸ Ӓ۽ ࢎਊ೧ب ؾפ քझਸ ҳ࠙ೞ۰ݶ ഛ۽ OKL
ܳ ॳݶ ؾפ ױ ٸח view engineب OKL۽ ߄Լঠ פ
ઁ քझ ޙߨਸ ߓਕࠁѷणפ ಌӒ৬ ઁо эਵ۽ ࠺Үೞݶࢲ ࠁݶ જणפ