<commit_before>require! { process, dockerode: Docker, express, 'body-parser' }

docker = new Docker!

err, containers <-! docker.list-containers  all: true
console.log containers

err, broker <-! docker.create-container Image: \databox-data-broker:latest name: \broker Tty: true

# TODO: Find some way to trap all exit and clean up asynchronously
process.on \SIGINT !->
  <-! broker.stop
  <-! broker.remove
  process.exit!

err, stream <-! broker.attach stream: true stdout: true stderr: true
stream.pipe process.stdout

err, data <-! broker.start

app = express!

app.enable 'trust proxy'

app.use express.static 'static'

app.use body-parser.urlencoded extended: false

app.post '/list-apps' (req, res) !->
  err, containers <-! docker.list-containers all: req.body.all
  containers |> JSON.stringify |> res.end

app.post '/list-store' (req, res) !->
  res.end '{}'

app.post '/400' (req, res) !->
  res.write-head 400
  res.end!

app.listen (process.env.PORT or 8080)<commit_msg>Start hello world app for testing<commit_after>require! { process, dockerode: Docker, express, 'body-parser' }

docker = new Docker!

err, containers <-! docker.list-containers  all: true
console.log containers

err, broker <-! docker.create-container Image: \databox-data-broker:latest name: \broker Tty: true

# TODO: Find some way to trap all exit and clean up asynchronously
process.on \SIGINT !->
  <-! broker.stop
  <-! broker.remove
  process.exit!

err, stream <-! broker.attach stream: true stdout: true stderr: true
stream.pipe process.stdout

err, data <-! broker.start

err, hello-world <-! docker.create-container Image: \databox-hello-world:latest name: \hello-world

err, data <-! hello-world.start PortBindings: '8080/tcp': [ HostPort: \8081 ]

app = express!

app.enable 'trust proxy'

app.use express.static 'static'

app.use body-parser.urlencoded extended: false

app.post '/list-apps' (req, res) !->
  err, containers <-! docker.list-containers all: req.body.all
  containers |> JSON.stringify |> res.end

app.post '/list-store' (req, res) !->
  res.end '{}'

app.post '/400' (req, res) !->
  res.write-head 400
  res.end!

app.listen (process.env.PORT or 8080)
{'fraction_non_alphanumeric': 0.14595842956120092, 'fraction_numerical': 0.012933025404157044, 'mean_word_length': 3.8783783783783785, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4567709', 'n_tokens_mistral': 790, 'n_tokens_neox': 728, 'n_words': 210}