Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data.css = obj.css
//const html = ReactDOM.renderToStaticMarkup();
//const html = ReactDOM.renderToStaticMarkup(<div>);
const resutl = Omi.renderToString()
res.status(route.status || 200);
res.send(`${resutl.html}`);
} catch (err) {
next(err);
}
});
//
// Error handling
// -----------------------------------------------------------------------------
const pe = new PrettyError();
pe.skipNodeFiles();
pe.skipPackage('express');
// eslint-disable-next-line no-unused-vars
app.use((err, req, res, next) => {
console.error(pe.render(err));
res.status(err.status || 500);
res.send(`${'error!'}`);
});
//
// Hot Module Replacement
// -----------------------------------------------------------------------------
if (module.hot) {
app.hot = module.hot;
//module.hot.accept();</div>
import { Readable } from 'stream';
import { join, relative, resolve, sep } from 'path';
import { resolve as resolveUrl } from 'url';
import fs from 'fs';
import util from 'util';
import minimatch from 'minimatch';
import mime from 'mime';
import inquirer from 'inquirer';
import { config as awsConfig } from 'aws-sdk';
import { createHash } from 'crypto';
import isCI from 'is-ci';
import { getS3WebsiteDomainUrl, withoutLeadingSlash } from './util';
import { AsyncFunction, asyncify, parallelLimit } from 'async';
const cli: any = yargs();
const pe = new PrettyError();
const OBJECTS_TO_REMOVE_PER_REQUEST = 1000;
const promisifiedParallelLimit: (tasks: Array>, limit: number) =>
// Have to cast this due to https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20497
// tslint:disable-next-line:no-any
Promise = util.promisify(parallelLimit) as any;
const guessRegion = (s3: S3, constraint: void | string | undefined) => (
constraint || s3.config.region || awsConfig.region
);
const getBucketInfo = async (config: PluginOptions, s3: S3): Promise<{ exists: boolean, region?: string }> => {
try {
const { $response } = await s3.getBucketLocation({ Bucket: config.bucketName }).promise();
mongoose.connect(process.env.mongoURI);
}
}
// require('../server.babel'); // babel registration (runtime transpilation for node)
import express from 'express';
import session from 'express-session';
import bodyParser from 'body-parser';
import config from '../src/config';
import PrettyError from 'pretty-error';
import http from 'http';
const pretty = new PrettyError();
const app = express();
const server = new http.Server(app);
/*--------*/
// Configure app login, session, and passport settings
/*--------*/
const MongoStore = require('connect-mongo')(session);
const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;
const User = require('./models').User;
passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function(err, user) {
if (err) { return done(err); }
if (!user) {
github.repos.getCommits(options, (error, response) => {
redis.set(key, JSON.stringify(response));
redis.expire(key, config.cacheExpiration);
if (error) {
const response = JSON.parse(error.message);
const prettyError = new PrettyError();
console.log(prettyError.render(new Error(response.message)));
reject();
return;
}
resolve(response);
});
return (err, req, res, next) => {
const status = err.status || err.code || 500;
const message = err.message || '';
let result = {
status,
message,
};
if (err.errors) {
result.errors = err.errors;
}
const renderedError = new PrettyError().render(err);
const serializedError = JSON.stringify(result, 2, 2);
log.error(false, `${renderedError}${serializedError}`);
res.status(status).json(result);
};
}
const logError = error => {
const errorFormatter = new PrettyError()
if (npmlog.level === 'verbose')
process.stderr.write(`ERR: ${errorFormatter.render(error)}`)
else process.stderr.write(`ERR: ${error.message || error}`)
}
const logError = error => {
const errorFormatter = new PrettyError()
if (args.logLevel === 'debug')
process.stderr.write(`ERR: ${errorFormatter.render(error)}`)
else process.stderr.write(`ERR: ${error.message || error}`)
}