<commit_before>var http = require('http');
var express = require('express');
var exp_hbs = require('express-handlebars');
var path = require('path');

var app = express();

//directory for static html files
var public_dir = './public/';

//sets the port number
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname,'views'));
app.engine('handlebars',
           exp_hbs({defaultLayout: 'main'}));
app.set('view engine', 'handlebars');

//we'll have static files in ./public folder
app.use(express.static(path.join(__dirname, 'public'))); 


//Examples of how to serve dynamic and static views

//rendered homepage
app.get('/', function (req, res) {
  res.render('index');
});

//custom rendered view
app.get('/about', function (req, res) {
  res.render('about');
});

//dynamic content example
app.get('/opened-at-timestamp', function (req, res) {
  var time = Date.now();
  res.render('opened-at-timestamp', {
              timestamp: time,
              username: 'Bob'
  });
});

//serving static html files
app.get('/static-example', function (req, res) {
  res.sendFile(public_dir + 'static-example.html');
});

//creates the server instance, and prints status message to console
http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});<commit_msg>add 404 not found routing<commit_after>var http = require('http');
var express = require('express');
var exp_hbs = require('express-handlebars');
var path = require('path');

var app = express();

//directory for static html files
var public_dir = './public/';

//sets the port number
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname,'views'));
app.engine('handlebars',
           exp_hbs({defaultLayout: 'main'}));
app.set('view engine', 'handlebars');

//we'll have static files in ./public folder
app.use(express.static(path.join(__dirname, 'public'))); 


//Examples of how to serve dynamic and static views

//rendered homepage
app.get('/', function (req, res) {
  res.render('index');
});

//custom rendered view
app.get('/about', function (req, res) {
  res.render('about');
});

//dynamic content example
app.get('/opened-at-timestamp', function (req, res) {
  var time = Date.now();
  res.render('opened-at-timestamp', {
              timestamp: time,
              username: 'Bob'
  });
});

//serving static html files
app.get('/static-example', function (req, res) {
  res.sendFile(public_dir + 'static-example.html');
});


//page not found
app.use(function (req,res) {
      res.render('404', {url:req.url});
});

//creates the server instance, and prints status message to console
http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});
{'fraction_non_alphanumeric': 0.18336886993603413, 'fraction_numerical': 0.004975124378109453, 'mean_word_length': 4.165137614678899, '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': '1574985', 'n_tokens_mistral': 881, 'n_tokens_neox': 847, 'n_words': 239}