text: var express = require('express')
  var app = express()
  var fs = require('fs');
  var bodyParser = require('body-parser');
  var compression = require('compression');
  var indexRouter = require('./routes/index');
  var topicRouter = require('./routes/topic');
  var helmet = require('helmet');
  app.use(helmet());
  
  app.use(express.static('public'));
  app.use(bodyParser.urlencoded ({extended: false}));
  app.use(compression());
  app.get('*', (request, response, next) => {
    fs.readdir('./data', (error, filelist) => {
      request.list = filelist;
      next();
    });
  });
  
  app.use('/', indexRouter);
  app.use('/topic', topicRouter);
  
  app.use((req, res, next) => {
    res.status(404).send('Sorry cant find that!');
  });
  
  app.use((err, req, res, next) => {
    console.error(err.stack)
    res.status(500).send('Something broke!')
  });
  
  app.listen(3000, () => console.log('3000번 포트로 서버 가동!'))
  
   