<commit_before>const express = require('express')
const path = require('path')
const findRandomVideo = require('./findRandomVideo')

const port = process.env.PORT || 3001
const app = express()

app.use(express.static(path.join(__dirname, '../../client/dist')))

app.get('/find-random-video', function(req, res) {
  findRandomVideo().then(id => res.json({ id: id }))
})

app.listen(port, function() {
  console.log(`Listening on port ${port}!`)<commit_msg>Handle errors while finding random video in the API 👻<commit_after>const express = require('express')
const path = require('path')
const findRandomVideo = require('./findRandomVideo')

const port = process.env.PORT || 3001
const app = express()

app.use(express.static(path.join(__dirname, '../../client/dist')))

app.get('/find-random-video', function(req, res) {
  findRandomVideo()
    .then(id => res.json({ id: id }))
    .catch(() => res.status(500).send('Something broke!'))
})

app.listen(port, function() {
  console.log(`Listening on port ${port}!`)
{'fraction_non_alphanumeric': 0.19230769230769232, 'fraction_numerical': 0.010848126232741617, 'mean_word_length': 5.041666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '3699519', 'n_tokens_mistral': 327, 'n_tokens_neox': 318, 'n_words': 74}