<commit_before>import path from 'path';
import React from 'react';
import express from 'express';
import { ParseServer } from 'parse-server';
import compression from 'compression';
import favicon from 'serve-favicon';
import { renderToString } from 'react-dom/server';
import { match, RouterContext } from 'react-router';
import { Provider } from 'react-redux';
import createRoutes from './routes';
import configureStore from './store/configureStore';
import config from './config';
import Html from './Html';

const protocol = 'http://';
const host = process.env.HOST || 'localhost';
const port = process.env.PORT || 3000;

const api = new ParseServer({
  databaseURI: 'mongodb://localhost/dev',
  appId: config.parseAppId,
  masterKey: 'MASTER_KEY_HERE',
  serverURL: protocol + host + ':' + port
});

const app = express();

app.use(compression());
app.use(favicon(path.join(__dirname, '..', 'static', 'favicon.ico')));

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

app.use(config.parseMountPoint, api);


// TODO: need to cache break main.js
const assets = {
  javascript: {
    main: __DEVELOPMENT__ ? 'http://localhost:3001/dist/main.js' : '/dist/main.js'
  }
};

app.use((req, res) => {

  const store = configureStore();

  // this gets called if server side rendering/routing has problems and errors
  function hydrateOnClient() {
    res.send('<!doctype html>\n' +
      renderToString(<Html assets={assets} store={store} />)
    );
  }<commit_msg>add change me note for master key in parse config<commit_after>import path from 'path';
import React from 'react';
import express from 'express';
import { ParseServer } from 'parse-server';
import compression from 'compression';
import favicon from 'serve-favicon';
import { renderToString } from 'react-dom/server';
import { match, RouterContext } from 'react-router';
import { Provider } from 'react-redux';
import createRoutes from './routes';
import configureStore from './store/configureStore';
import config from './config';
import Html from './Html';

const protocol = 'http://';
const host = process.env.HOST || 'localhost';
const port = process.env.PORT || 3000;

const api = new ParseServer({
  databaseURI: 'mongodb://localhost/dev',
  appId: config.parseAppId,
  masterKey: 'MASTER_KEY_HERE' // ######## CHANGE ME FOR PRODUCTION ########
  serverURL: protocol + host + ':' + port
});

const app = express();

app.use(compression());
app.use(favicon(path.join(__dirname, '..', 'static', 'favicon.ico')));

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

app.use(config.parseMountPoint, api);


// TODO: need to cache break main.js
const assets = {
  javascript: {
    main: __DEVELOPMENT__ ? 'http://localhost:3001/dist/main.js' : '/dist/main.js'
  }
};

app.use((req, res) => {

  const store = configureStore();

  // this gets called if server side rendering/routing has problems and errors
  function hydrateOnClient() {
    res.send('<!doctype html>\n' +
      renderToString(<Html assets={assets} store={store} />)
    );
  }
{'fraction_non_alphanumeric': 0.1630971993410214, 'fraction_numerical': 0.005271828665568369, 'mean_word_length': 4.47027027027027, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '5235402', 'n_tokens_mistral': 967, 'n_tokens_neox': 927, 'n_words': 263}