Switch ES2015 example to use middleware inlined into Startup.cs instead of MVC controller/action

This commit is contained in:
SteveSandersonMS
2015-11-02 21:02:47 -08:00
parent 0c59f670b2
commit e410affbd8
3 changed files with 21 additions and 35 deletions

View File

@@ -1,9 +1,11 @@
var fs = require('fs');
var babelCore = require('babel-core');
module.exports = function(cb, fileContents, url) {
var result = babelCore.transform(fileContents, {
module.exports = function(cb, physicalPath, requestPath) {
var originalContents = fs.readFileSync(physicalPath);
var result = babelCore.transform(originalContents, {
sourceMaps: 'inline',
sourceFileName: '/sourcemapped/' + url
sourceFileName: '/sourcemapped' + requestPath
});
cb(null, result.code);
}