Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var express = require('express'),
app = express(),
_ = require('underscore'),
os = require('os'),
sys = require('sys'),
exec = require('child_process').exec,
argv = require('yargs').argv;
var autoShutDownMs = (Number(argv.t) === argv.t && argv.t % 1 === 0) ? 1000 * 60 * argv.t : 1000 * 60 * 15;
var rootDir = __dirname;
var port = argv.p || 3001;
app.use(express.json());
app.use(express.urlencoded());
app.use(express.static(rootDir));
// app.all('/app/',function(req,res){
// console.log(new Date());
// exec("gulp test",puts);
// res.send('ok');
// })
var listenerHook = app.listen(port);
//===================
console.log();
console.log('Current Directory: '+__dirname);
console.log('Serving files from: '+rootDir);
console.log('Listening on: ' + getAddresses() + ':' + port + '');
console.log('Press Ctrl + C to stop.');
const multipart = require('connect-multiparty')
const app = express()
app.use((req, res, next) => {
res.setHeader('X-Powered-By', `hubot/${this.name}`)
return next()
})
if (user && pass) {
app.use(express.basicAuth(user, pass))
}
app.use(express.query())
app.use(express.json())
app.use(express.urlencoded({ limit, parameterLimit: paramLimit }))
// replacement for deprecated express.multipart/connect.multipart
// limit to 100mb, as per the old behavior
app.use(multipart({ maxFilesSize: 100 * 1024 * 1024 }))
if (stat) {
app.use(express.static(stat))
}
try {
this.server = app.listen(port, address)
this.router = app
} catch (error) {
const err = error
this.logger.error(`Error trying to start HTTP server: ${err}\n${err.stack}`)
process.exit(1)
}
const ReduisStore = require("connect-redis")(session);
// var indexRouter = require("./routes/index");
// var usersRouter = require("./routes/users");
const blogRouter = require("./routes/blog");
const userRouter = require("./routes/user");
var app = express();
// view engine setup
// app.set("views", path.join(__dirname, "views"));
// app.set("view engine", "jade");
app.use(logger("dev"));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
// app.use(express.static(path.join(__dirname, "public")));
const redisClient = require("./db/redis");
const sessionStore = new ReduisStore({
client: redisClient
})
app.use(session({
secret: "WJiol#23123_",
cookie: {
// path: '/', // 默认配置
// httpOnly: true, // 默认配置
maxAge: 24 * 60 * 60 * 1000
},
store: sessionStore
app.configure(function () {
app.use(express.cookieParser('play me off keyboard cat'));
app.use(express.session({ secret: "keyboard cat", cookie: { maxAge: 1000*60*60*24*365 }}));
app.use(flash());
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(busboy());
app.use(harp.mount(projectPath));
app.use(express.static(__dirname + "/public"));
app.use(dynHelpers.helpers(editor));
app.set("view engine", "jade");
app.set('views', __dirname + '/views');
// Just needed to parse html files
app.engine('html', require('ejs').renderFile);
});
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var indexRouter = require('./routes/index');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({extended: false}));
app.use(cookieParser());
const isDeveloping = process.env.NODE_ENV !== 'production';
if (isDeveloping) {
let webpack = require('webpack');
let webpackMiddleware = require('webpack-dev-middleware');
let config = require('./webpack.config.js');
let compiler = webpack(config);
// serve the content using webpack
app.use(webpackMiddleware(compiler, {
publicPath: '/',
}));
} else {
// serve the content using static directory
app.use(express.static(staticPath));
var indexRouter = require('./routes/index');
var apiRouter_v1 = require('./routes/V1');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
app.set('superSecret', config.secret); // secret variable
app.set('noAuthRoutes', config.noAuthRoutes); // secret variable
app.set('tokenExpiration', config.tokenExpiration); // secret variable
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter);
app.use('/api', apiRouter_v1);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.all('*', function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Content-Type,Content-Length, Authorization, Accept,X-Requested-With");
res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
res.header("X-Powered-By", ' 3.2.1')
if (req.method == "OPTIONS") res.send(200);
else next();
});
app.use('/', indexRouter);
app.use('/users', usersRouter);
// catch 404 and forward to error handler
var config = require('./routes/config');
var http = require('http');
var path = require('path');
var checker = require('./jobs/checker');
var app = express();
app.locals.moment = require('moment');
// all environments
app.set('port', process.env.PORT || 3001);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(app.router);
app.use(require('less-middleware')(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'public')));
// development only
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}
app.get('/', routes.index);
app.get('/update', routes.update);
app.get('/search', search.runSearch);
app.get('/add', list.add);
var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
var arDrone = require('ar-drone');
//var dronestream = require("dronestream")
var drone = arDrone.createClient();
// all environments
app.set('port', process.env.PORT || 3000);
app.use(allowCors);
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
// development only
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}
var actions = [
'takeoff',
'land',
'up',
'down',
'clockwise',
'counterClockwise',
const express = require('express');
const app = express();
const router = express.Router();
const path = require('path');
const marked = require('marked');
const fs = require('fs');
app.use('/', router);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static(__dirname + '/out'));
app.use('/docs', express.static(__dirname + '/docs'));
app.use('/cards', express.static(__dirname + '/cards'));
app.use(express.static(__dirname + '/site'));
router.get('/', (req, res) => {
res.sendFile(__dirname + '/site/index.html');
});
app.get('/creator', (req, res) => {
res.sendFile(__dirname + '/site/creator.html');
});
app.post('/create', (req, res) => {
const { spawn } = require('child_process');