<commit_before>var express  = require('express'),
    router   = express.Router();

var Board = require('../models/board');

router.route('/boards')

  // GET /boards
  .get(function (req, res) {
    res.json({message: "Fake GET index route!"});
  })

  // POST /boards
  .post(function (req, res) {
    //Board.findOne({ fbId: req.fbUser }, function (err, board) {
      //if (err) {
        //res.json(err);
      //} else if (board) {
        //// 409: request could not be completed due to a conflict with 
        //// the current state of the resource
        //res.status(409).json({ message: "Board already exists." });
      //} else {

        var board = new Board();
        //board.fbId = req.fbUser;
        board.save(function (err) {
          if (err) {
            res.send(err);
          } else {
            res.json(board);
          }
        });

      //}
    });
  //});

router.route('/boards/:boardId')

  // GET /boards/12345
  .get(function(req, res) {
    Board.findById(req.params.boardId, function (err, board) {
      if (err)
        res.send(err);

      res.json(board);
    });
  })

  // PUT /boards/12345
  .put(function (req, res) {
    Board.findById(req.params.boardId, function (err, board) {
      console.log("---- BOARD ----");
      console.log(board);
      if (err)
        res.send(err)
      
      for (prop in req.body) {
        board[prop] = req.body[prop];
      }

      board.save(function (err) {
        if (err)
          res.send(err);

        res.json(board);
      });
    });
  });

module.exports = router;<commit_msg>More debug<commit_after>var express  = require('express'),
    router   = express.Router();

var Board = require('../models/board');

router.route('/boards')

  // GET /boards
  .get(function (req, res) {
    res.json({message: "Fake GET index route!"});
  })

  // POST /boards
  .post(function (req, res) {
    //Board.findOne({ fbId: req.fbUser }, function (err, board) {
      //if (err) {
        //res.json(err);
      //} else if (board) {
        //// 409: request could not be completed due to a conflict with 
        //// the current state of the resource
        //res.status(409).json({ message: "Board already exists." });
      //} else {

        var board = new Board();
        //board.fbId = req.fbUser;
        board.save(function (err) {
          if (err) {
            res.send(err);
          } else {
            res.json(board);
          }
        });

      //}
    });
  //});

router.route('/boards/:boardId')

  // GET /boards/12345
  .get(function(req, res) {
    Board.findById(req.params.boardId, function (err, board) {
      if (err)
        res.send(err);

      res.json(board);
    });
  })

  // PUT /boards/12345
  .put(function (req, res) {
    Board.findById(req.params.boardId, function (err, board) {
      console.log("---- BOARD ----");
      console.log(board);
      if (err)
        res.send(err)
      
      for (prop in req.body) {
        console.log(prop + " : " + board[prop] + ", " + req.body[prop]);
        board[prop] = req.body[prop];
      }

      board.save(function (err) {
        if (err)
          res.send(err);

        res.json(board);
      });
    });
  });

module.exports = router;
{'fraction_non_alphanumeric': 0.1810610734114744, 'fraction_numerical': 0.00987045033929673, 'mean_word_length': 1.7576530612244898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '607272', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1046, 'n_words': 231}