<commit_before>const express = require('express')
const bodyParser = require('body-parser');
const path = require('path');
const { User, Template, Activity, History } = require('../db/mongoose-schemas.js')
const app = express();
const logger = require('morgan');
const cors = require('cors');
const jwt = require('express-jwt');
const { secret, audience } = require('./secret/jwt');

app.use(cors());

app.set('port', (process.env.PORT || 3002));
const PORT = app.get('port');

app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.use('/',express.static(path.join(__dirname, '../client')));

// AUTH0
app.use('/login', express.static(path.join(__dirname, '../src')));

//HANDLE GET REQUESTS
const authCheck = jwt({ secret, audience, credentialsRequired: true });
// SET UP A PUBLIC AND PRIVATE ENDPOINT
app.get('/api/public', (req, res) => {
  console.log('hi from /api/public')
  res.json({ message: "Hello from a public endpoint!. You don't need to be authenticated to see this." })
});

// to protect this endpoint pass our middleware as second arg
// will require an auth header to be present for user to go through to this endpoint
app.get('/api/private', authCheck, (req, res) => {
  res.json({ message: "Hello from a private endpoint!. You DO need to be authenticated to see this." })
});


//
<commit_msg>Add Private Vars Attached to process.env<commit_after>const express = require('express')
const bodyParser = require('body-parser');
const path = require('path');
const { User, Template, Activity, History } = require('../db/mongoose-schemas.js')
const app = express();
const logger = require('morgan');
const cors = require('cors'); // allow cors headers
const jwt = require('express-jwt');
require('dotenv').config(); // allows you to use .env file

app.use(cors());

app.set('port', (process.env.PORT || 3002));
const PORT = app.get('port');

app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.use('/',express.static(path.join(__dirname, '../client')));

// AUTH0
app.use('/login', express.static(path.join(__dirname, '../src')));


//HANDLE GET REQUESTS
const authCheck = jwt({ secret: process.env.SECRET, audience: process.env.AUDIENCE, credentialsRequired: true });
// SET UP A PUBLIC AND PRIVATE ENDPOINT
app.get('/api/public', (req, res) => {
  console.log('hi from /api/public')
  res.json({ message: "Hello from a public endpoint!. You don't need to be authenticated to see this." })
});

// to protect this endpoint pass our middleware as second arg
// will require an auth header to be present for user to go through to this endpoint
app.get('/api/private', authCheck, (req, res) => {
  res.json({ message: "Hello from a private endpoint!. You DO need to be authenticated to see this." })
});


//

{'fraction_non_alphanumeric': 0.17707231040564375, 'fraction_numerical': 0.003527336860670194, 'mean_word_length': 4.604743083003952, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5062995', 'n_tokens_mistral': 877, 'n_tokens_neox': 851, 'n_words': 281}