<commit_before>module.exports = createApp;

var express = require('express');
var session = require('express-session');
var uuid = require('node-uuid');
var cors = require('cors');
var debug = require('./debug');
var LDP = require('./ldp');
var LdpMiddleware = require('./ldp-middleware');
var proxy = require('./handlers/proxy')
var IdentityProvider = require('./identity-provider');
var vhost = require('vhost');
var path = require('path');
var corsSettings = cors({
    methods: [
        'OPTIONS', 'HEAD', 'GET',
        'PATCH', 'POST', 'PUT', 'DELETE'
    ],
    exposedHeaders: 'User, Location, Link, Vary, Last-Modified, Content-Length',
    credentials: true,
    maxAge: 1728000,
    origin: true
});

function createApp (argv) {
    var ldp = new LDP(argv);
    var app = express();

    // Setting options as local variable
    app.locals.ldp = ldp;

    var sessionSettings = {
        secret: ldp.secret || uuid.v1(),
        saveUninitialized: false,
        resave: false
    }

    // Cookies should set to be secure if https is on
    if (ldp.webid || ldp.idp) {
        sessionSettings.cookie = {
            secure: true
        }
    }

    // Session
    app.use(session(sessionSettings));

    // Adding proxy
    if (ldp.proxy) {
        proxy(app, ldp.proxy);
    }

    // Adding Multi-user support
    if (ldp.idp || ldp.signup) {
        var idp = IdentityProvider({
            store: ldp,
            suffixAcl: ldp.suffixAcl
        })
        app.use('/accounts', idp.middleware(corsSettings));
        app.use('/', corsSettings, idp.get.bind(idp))
    }

    if (ldp.idp) {
        app.use(vhost('*', LdpMiddleware(corsSettings)));
    }

    if (ldp.signup) {
        app.get('/', function (req, res) {
            res.set('Content-Type', 'text/html');
            var signup = path.resolve('../static/signup.html')
            res.sendFile(signup);
        });
    }
    app.use('/', LdpMiddleware(corsSettings));

    return app;
}
<commit_msg>solving path issue<commit_after>module.exports = createApp;

var express = require('express');
var session = require('express-session');
var uuid = require('node-uuid');
var cors = require('cors');
var debug = require('./debug');
var LDP = require('./ldp');
var LdpMiddleware = require('./ldp-middleware');
var proxy = require('./handlers/proxy')
var IdentityProvider = require('./identity-provider');
var vhost = require('vhost');
var path = require('path');
var corsSettings = cors({
    methods: [
        'OPTIONS', 'HEAD', 'GET',
        'PATCH', 'POST', 'PUT', 'DELETE'
    ],
    exposedHeaders: 'User, Location, Link, Vary, Last-Modified, Content-Length',
    credentials: true,
    maxAge: 1728000,
    origin: true
});

function createApp (argv) {
    var ldp = new LDP(argv);
    var app = express();

    // Setting options as local variable
    app.locals.ldp = ldp;

    var sessionSettings = {
        secret: ldp.secret || uuid.v1(),
        saveUninitialized: false,
        resave: false
    }

    // Cookies should set to be secure if https is on
    if (ldp.webid || ldp.idp) {
        sessionSettings.cookie = {
            secure: true
        }
    }

    // Session
    app.use(session(sessionSettings));

    // Adding proxy
    if (ldp.proxy) {
        proxy(app, ldp.proxy);
    }

    // Adding Multi-user support
    if (ldp.idp || ldp.signup) {
        var idp = IdentityProvider({
            store: ldp,
            suffixAcl: ldp.suffixAcl
        })
        app.use('/accounts', idp.middleware(corsSettings));
        app.use('/', corsSettings, idp.get.bind(idp))
    }

    if (ldp.idp) {
        app.use(vhost('*', LdpMiddleware(corsSettings)));
    }

    if (ldp.signup) {
        app.get('/', function (req, res) {
            res.set('Content-Type', 'text/html');
            var signup = path.resolve(__dirname + '/../static/signup.html')
            res.sendFile(signup);
        });
    }
    app.use('/', LdpMiddleware(corsSettings));

    return app;
}

{'fraction_non_alphanumeric': 0.15829145728643215, 'fraction_numerical': 0.004020100502512563, 'mean_word_length': 2.4025641025641025, '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': '3990430', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1268, 'n_words': 297}