<commit_before>import express from 'express';
import users from '../db/controllers/users';

const router = express.Router();

router.post('/', (req, res) => {
  const userParams = req.body;

  users.saveNewUser(userParams)
    .then((user) => {
      if (user) {
        res.status(201).json({ message: 'Registration Successful' });
      }<commit_msg>Register route refactor<commit_after>import express from 'express';
import { development as devconfig } from '../../knexfile';
import knexModule from 'knex';
import bookshelfModule from 'bookshelf';
import bookshelfBcrypt from 'bookshelf-bcrypt';
import User from '../db/controllers/users';
import Model from '../db/models/users';
const knex = knexModule(devconfig);
const knexdb = bookshelfModule(knex).plugin(bookshelfBcrypt);
const usersModel = Model(knexdb);


const router = express.Router();

router.post('/', (req, res) => {
  const userParams = req.body;

  User.saveNewUser(userParams, usersModel)
    .then((user) => {
      if (user) {
        res.status(201).json({ message: 'Registration Successful' });
      }
{'fraction_non_alphanumeric': 0.1533457249070632, 'fraction_numerical': 0.0055762081784386614, 'mean_word_length': 4.177884615384615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '208425', 'n_tokens_mistral': 338, 'n_tokens_neox': 322, 'n_words': 84}