npm install nodemon --save-dev

npm install --save express

미들웨어 추가

app.use();

user 에는 3가지의 인수응 받는데 req, res, next 이다.

next 는 미들웨어부터 다른 미들웨어를 실헹하는데 사용

app.use((req, res, next) => {
    console.log('In the middleware!');
    // Alows the reauest to contiue to the next middleware in line
    next();
});

app.use((req, res, next) => {
    console.log('In another middleware!');
    // ...
});
const express = require('express');

const app = express();

app.use((req, res, next) => {
    console.log('In the middleware!');
    // Alows the reauest to contiue to the next middleware in line
    next();
});

app.use((req, res, next) => {
    console.log('In another middleware!');
    res.send('<h1>Hello from Express</h1>');
});

app.listen(3000);

request body를 읽기 위해서는

npm install --save body-parser

app.post, app.get 등등 으로 실행 제한

Templating Engines

Managing Data(without a Databas)

Render Dynamic Content in yout Views

Understanding Templating Engines