<commit_before>const express = require('express');
const jwt = require('jsonwebtoken');

const { tokenSecret } = require('../config/main.config');
const User = require('../models/user.model');

const router = express.Router();

router.post('/register', (req, res) => {
  console.log(req.body);
  const { username, password } = req.body;
  const newUser = new User({ username, password });
  if (!username || !password) {
    res.status(400);
    res.json({
      message: 'Both a valid username and password need to be provided',
    });
    return false;
  }

  newUser.save()
    .then((savedUser) => {
      res.status(200);
      res.json({
        message: `${savedUser.username} Saved successfully`,
      });
      return true;
    })
    .catch((error) => {
      console.error(error);
      res.status(400);
      res.json({
        message: error.errmsg,
        code: error.code,
      });
      return false;
    });<commit_msg>Remove unecessary comment<commit_after>const express = require('express');
const jwt = require('jsonwebtoken');

const { tokenSecret } = require('../config/main.config');
const User = require('../models/user.model');

const router = express.Router();

router.post('/register', (req, res) => {
  const { username, password } = req.body;
  const newUser = new User({ username, password });
  if (!username || !password) {
    res.status(400);
    res.json({
      message: 'Both a valid username and password need to be provided',
    });
    return false;
  }

  newUser.save()
    .then((savedUser) => {
      res.status(200);
      res.json({
        message: `${savedUser.username} Saved successfully`,
      });
      return true;
    })
    .catch((error) => {
      console.error(error);
      res.status(400);
      res.json({
        message: error.errmsg,
        code: error.code,
      });
      return false;
    });
{'fraction_non_alphanumeric': 0.1676486341724692, 'fraction_numerical': 0.0096411355115158, 'mean_word_length': 2.7063492063492065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3701602', 'n_tokens_mistral': 577, 'n_tokens_neox': 562, 'n_words': 135}