<commit_before>var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');

var routes = require('./routes/index');
var users = require('./routes/users');
expressRest = require('express-rest');
var app = express();
var rest = expressRest(app);
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
// app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, '/')));


var mongoose = require('mongoose');
mongoose.connect('mongodb://0.0.0.0/library');

var borrowers = mongoose.model('borrowers', { name: String, role : String, id : String, booksIssued : [{ name : String, accessionNumber: String, issuedOn : String }] });
var books = mongoose.model('books', { name: String, accessionNumber : Number, category : String, author : String, publication : String, edition : String, status : String });

rest.post('/api/registerbook/', function(req, res) {
    var book = new books(req.body);
    console.log(req.body, book)
    book.save(function (err) {
        if (err) {
            console.log('Error occured while registering new book.'+err);
            res.badRequest();
        } else {
            res.created();
        }
    });
});


rest.post('/api/registerborrower/', function(req, res) {
    var borrower = new borrowers(req.body);
    borrower.save(function (err) {
        if (err) {
            console.log('Error occured while registering new borrower.'+err);
            res.badRequest();
        } else {
            console.log('Registration Successful.');
            res.created();
        }<commit_msg>vague changes<commit_after>var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');

var routes = require('./routes/index');
var users = require('./routes/users');
expressRest = require('express-rest');
var app = express();
var rest = expressRest(app);
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
// app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, '/')));


var mongoose = require('mongoose');
<<<<<<< HEAD
mongoose.connect('mongodb://0.0.0.0/library');

var borrowers = mongoose.model('borrowers', { name: String, role : String, id : String, booksIssued : [{ name : String, accessionNumber: String, issuedOn : String }] });
var books = mongoose.model('books', { name: String, accessionNumber : Number, category : String, author : String, publication : String, edition : String, status : String });

rest.post('/api/registerbook/', function(req, res) {
    var book = new books(req.body);
    console.log(req.body, book)
    book.save(function (err) {
        if (err) {
            console.log('Error occured while registering new book.'+err);
            res.badRequest();
        } else {
            res.created();
        }
    });
});


rest.post('/api/registerborrower/', function(req, res) {
    var borrower = new borrowers(req.body);
    borrower.save(function (err) {
        if (err) {
            console.log('Error occured while registering new borrower.'+err);
            res.badRequest();
        } else {
            console.log('Registration Successful.');
            res.created();
        }
{'fraction_non_alphanumeric': 0.17482872367419436, 'fraction_numerical': 0.0020299416391778738, 'mean_word_length': 3.6485849056603774, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4338991', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1169, 'n_words': 280}