6e0991ccaa201751246dac8411e1c8f6c3c237da
Gitcub / index.js
const express = require('express')
const fs = require('fs')
const app = express()
const port = 3000

app.set('view engine', 'pug')
app.set('views', './views')

app.get('/:repository', (req, res) => {
  var dirList = fs.readdirSync('./user-content-access/' + req.params.repository, (err, files) => {
    if (err)
      console.log(err)
    else
      return files
  })
  
  dirList.forEach (file => console.log(file) )
  
  res.render('index', {
    dirList: dirList
  })
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
}) 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27