<commit_before>var express = require('express'),
    router = express.Router(),
    scv = require('./scv.js'),
    bodyParser = require('body-parser'),
    request = require('request'),
    path = __dirname + '/dist/',
    config = require('../config.js');

    // Use dotenv if Dev.
    if (process.env.NODE_ENV !== 'production') require('dotenv').config()

// Main page
router.get('/', function(req, res){
    var error = config.scv.error3;
    try{
        res.sendFile(path + "index.html");
    }catch(e){
        res.send(error3);
    }

});

// Ping endpoint
router.get('/api/ping', function(req, res){
    var error = config.scv.error;
    try{
        var message = scv.hello();
        res.setHeader('Content-Type', 'application/json');
        res.send(JSON.stringify({ response: message }));
    }catch(e){
        res.send(JSON.stringify({ response: error }));
    }
});

// Webhook endpoint
router.get('/api/webhook', function(req, res){
    var error = config.scv.error2;
    var veriError = config.facebook.verificationError;
    try{
        // Verification
        if (req.query['hub.verify_token'] === process.env.VERIFY_ACCESS_TOKEN) {
            res.send(req.query['hub.challenge'])
        }
        res.send(JSON.stringify({ response: veriError }));

    }catch(e){
        res.send(JSON.stringify({ response: error}));
    }
});

module.exports = router;<commit_msg>added post webhook<commit_after>var express = require('express'),
    router = express.Router(),
    scv = require('./scv.js'),
    path = __dirname + '/dist/',
    config = require('../config.js');

    // Use dotenv if Dev.
    if (process.env.NODE_ENV !== 'production') require('dotenv').config()

// Main page
router.get('/', function(req, res){
    var error = config.scv.error3;
    try{
        res.sendFile(path + "index.html");
    }catch(e){
        res.send(error3);
    }

});

// Ping endpoint
router.get('/api/ping', function(req, res){
    var error = config.scv.error;
    try{
        var message = scv.hello();
        res.setHeader('Content-Type', 'application/json');
        res.send(JSON.stringify({ response: message }));
    }catch(e){
        res.send(JSON.stringify({ response: error }));
    }
});

// Facebook verification
router.get('/api/webhook', function(req, res){
    var error = config.scv.error2;
    var veriError = config.facebook.verificationError;
    try{
        // Verification
        if (req.query['hub.verify_token'] === process.env.VERIFY_ACCESS_TOKEN) {
            res.send(req.query['hub.challenge'])
        }
        res.send(JSON.stringify({ response: veriError }));

    }catch(e){
        res.send(JSON.stringify({ response: error}));
    }
});

// Webhook endpoint
router.post('/api/webhook', function(req, res){
    try{
        var data = req.body;
        
        // Ensure page subscription
        if(data.object == 'page'){
            data.entry.forEach(function(entry){
                entry.messaging.forEach(function(messagingEvent) {
                   
                });    
            });
        }
        res.sendStatus(200);
    }catch(e){
        res.sendStatus(500);
    }
});

module.exports = router;
{'fraction_non_alphanumeric': 0.17318611987381705, 'fraction_numerical': 0.0037854889589905363, 'mean_word_length': 2.4318181818181817, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '172946', 'n_tokens_mistral': 994, 'n_tokens_neox': 984, 'n_words': 184}