<commit_before>'use strict';

const express = require('express');
const router = express.Router();
const gameService = require('../services').gameService;
const userService = require('../services').userService;

router.get('/all', function(req, res, next) {
  gameService.getGames(req.session.user.email)
    .then((games) => {
      res.json(games);
    })
    .catch((err) => {
      res.status(500).json({
        error: 'error getting games',
      });
    });
});

router.post('/create', function(req, res, next) {
  gameService.create(req.body.name, req.body.players)
    .then((game) => {
      userService.getUser(req.session.user.email)
        .then((user) => {
          res.json(user);
        })
        .catch((err) => {
          res.status(500).json({
            error: 'error getting user',
          })
        });
    })
    .catch((err) => {
      res.status(500).json({
        error: 'error creating game',
      });
    });
});

module.exports = router;<commit_msg>create route now returns game data<commit_after>'use strict';

const express = require('express');
const router = express.Router();
const gameService = require('../services').gameService;
const userService = require('../services').userService;

router.get('/all', function(req, res, next) {
  gameService.getGames(req.session.user.email)
    .then((games) => {
      res.json(games);
    })
    .catch((err) => {
      res.status(500).json({
        error: 'error getting games',
      });
    });
});

router.post('/create', function(req, res, next) {
  gameService.create(req.body.name, req.body.players)
    .then((game) => {
      res.json(game);
    })
    .catch((err) => {
      res.status(500).json({
        error: 'error creating game',
      });
    });
});

module.exports = router;
{'fraction_non_alphanumeric': 0.19349411104879416, 'fraction_numerical': 0.008412787436904094, 'mean_word_length': 2.6935817805383024, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3469975', 'n_tokens_mistral': 572, 'n_tokens_neox': 556, 'n_words': 98}