Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/*
* expush
* https://github.com/Munter/expush
*
* Copyright (c) 2014 Peter Müller
* Licensed under the MIT license.
*/
'use strict';
var fs = require('fs'),
app = require('express')(),
spdy = require('spdy'),
async = require('async'),
AssetGraph = require('assetgraph'),
query = AssetGraph.query,
mime = require('mime'),
root = process.cwd(),
chalk = require('chalk'),
assetGraph = new AssetGraph({root: root + '/'});
// Self signed certs
var options = {
key: fs.readFileSync(__dirname + '/../keys/server.key'),
cert: fs.readFileSync(__dirname + '/../keys/server.crt'),
ca: fs.readFileSync(__dirname + '/../keys/server.csr')
};
function sendAsset(asset, req, res, next) {
var contentType = mime.types[asset.extension.substr(1) || 'application/octet-stream'],
etag = '"' + asset.md5Hex + '"',
ifNoneMatchHeaderValue = req.headers['if-none-match'];