<commit_before>var mongoose = require('mongoose');
var Schema = mongoose.Schema;

mongoose.connect('mongodb://localhost/test');



var express = require('express');
var app = express();

app.use(express.static(__dirname));
//app.use(express.bodyParser());

app.post('/goods', function(request, response){
    var Goods = require('./model/goods');
    goods = new Goods(request.body);
    goods.save(function() {
        response.send(goods);
    })
});
app.get('/goods', function(request, response){
    var Goods = require('./model/goods');
    Goods.find().exec(function(err, goods) {
        response.send({goods: goods});
    });
});

app.delete('/goods/:id', function(request, response) {
    var Goods = require('./model/goods');
    Goods.remove({_id: mongoose.Types.ObjectId(request.param('id'))}, function(err) {
        response.send({error:err});
    })
});



app.listen(3031);
console.log("Server started on port 3031");<commit_msg>refact code<commit_after>var mongoose = require('mongoose');
var Schema = mongoose.Schema;

mongoose.connect('mongodb://localhost/test');

var express = require('express');
var app = express();

app.use(express.static(__dirname));
//app.use(express.bodyParser());

app.post('/goods', function(request, response){
    var Goods = require('./model/goods');
    goods = new Goods(request.body);
    goods.save(function() {
        response.send(goods);
    })
});

app.get('/goods', function(request, response){
    var Goods = require('./model/goods');
    Goods.find().exec(function(err, goods) {
        response.send({goods: goods});
    });
});

app.delete('/goods/:id', function(request, response) {
    var Goods = require('./model/goods');
    Goods.remove({_id: mongoose.Types.ObjectId(request.param('id'))}, function(err) {
        response.send({error:err});
    })
});

app.listen(3031);
console.log("Server started on port 3031");
{'fraction_non_alphanumeric': 0.19946949602122016, 'fraction_numerical': 0.008488063660477453, 'mean_word_length': 4.167123287671233, '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': '5534339', 'n_tokens_mistral': 614, 'n_tokens_neox': 613, 'n_words': 104}