https://expressjs.com/en/4x/api.html#express
const options = {
dotfiles: 'ignore',
etag: false,
index: false,
maxAge: '1d',
redirect: false,
setHeaders: function (res, path, stat) {
res.set('x-timestamp', Date.now());
},
};
app.use(express.json());
// REST API -> Body
app.use(express.urlencoded({ extended: false }));
// HTML Form -> Body
app.use(express.static('public', options));
const corsOptions = {
origin: ['http://127.0.0.1:5500'],
optionsSuccessStatus: 200,
credentials: true, // allow the Access-Control-Allow-Credentials
};
app.use(cookieParser());
app.use(helmet());
// 보안 헤더
app.use(cors(corsOptions));
app.use(morgan('combined'));
// log