本文整理汇总了TypeScript中proxy-middleware.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: browserSync
let runServer = () => {
let baseDir = APP_DEST;
let routes:any = {
[`${APP_BASE}${APP_DEST}`]: APP_DEST,
[`${APP_BASE}node_modules`]: 'node_modules',
};
if (APP_BASE !== '/') {
routes[`${APP_BASE}`] = APP_DEST;
baseDir = `${DIST_DIR}/empty/`;
}
browserSync({
port: PORT,
startPath: APP_BASE,
server: {
baseDir: baseDir,
middleware: [
proxy({
protocol: 'http:',
hostname: 'localhost',
port: 3000,
pathname: '/api',
route: '/api'
}),
require('connect-history-api-fallback')({index: `${APP_BASE}index.html`})
],
routes: routes
}
});
};
开发者ID:victir,项目名称:todo-angular2-rails-api,代码行数:31,代码来源:code_change_tools.ts
示例2: WebpackDevServer
module.exports=(app)=>{
app.use("/static",proxy(url.parse(hotReloadServerUri + '/static')));
var bundleStart = null;
var compiler = webpack(config);
// We give notice in the terminal when it starts bundling and
// set the time it started
compiler.plugin('compile', ():void=> {
console.log('Bundling...');
bundleStart = Date.now();
});
// We also give notice when it is done compiling, including the
// time it took. Nice to have
compiler.plugin('done', ():void=> {
console.log('Bundled in ' + (Date.now() - bundleStart) + 'ms. ' + new Date().toString());
});
new WebpackDevServer(compiler, {
//contentBase: hotReloadServerUri || __dirname,
contentBase: "client",
hot: true,
noInfo: true,
publicPath: '/static/',
historyApiFallback: false,
stats: {colors: true},
// proxy: {
// "*": serverUri
// }
}).listen(hotReloadServerPort, hotReloadServerHost, ()=> {
console.log('Bundling project, please wait...'+hotReloadServerPort);
});
};
开发者ID:duanguang,项目名称:react-redux-demo,代码行数:33,代码来源:webpack-dev-server.ts
示例3: browserSync
gulp.task('serve:prod', ['build:prod'], () => {
// Proxy to localhost:8080
var proxyOptions = url.parse('http://localhost:8080/api');
proxyOptions.route = '/api';
proxyOptions.preserveHost = true;
browserSync({
logPrefix: 'VASS Angular2 Test',
port: 5000,
browser: 'google chrome',
server: {
baseDir: './dist',
middleware: [function (req, res, next) {
// CORS Origin....
res.setHeader('Access-Control-Allow-Origin', '*');
next();
}, proxy(proxyOptions)]
}
});
// Watch for changes on build folder. A change on src folder will make watch task run.
// This task will put the files on build folder.
// So, we ahve to watch on build folder to reload the browser
gulp.watch([
"/build/**/*.js",
"/build/**/*.css",
"/build/**/*.html"
], browserSync.reload);
});
开发者ID:nestis,项目名称:widgetFrontAngular2,代码行数:29,代码来源:gulpfile.ts
示例4: setupMiddleware
public setupMiddleware(): server {
const proxyOptions: ProxyOption = url.parse( 'http://' + this.option.remoteAddr );
proxyOptions.preserveHost = true;
proxyOptions.headers = {host: this.option.host};
this.app.use((req:http.IncomingMessage,res:http.ServerResponse,next:Function)=>{
this.option.logger.request(req,res);
next();
} );
this.app.use( '/api/recotw', proxy( proxyOptions ) );
this.app.use( serveStatic( this.option.root ) );
return this;
}
开发者ID:RecoTwExplorer,项目名称:recotw-proxy,代码行数:13,代码来源:server.ts
示例5: browserSync
let runServer = () => {
//browserSync.init(BROWSER_SYNC_CONFIG);
let baseDir = APP_DEST;
let routes: any = {
[`${APP_BASE}${APP_DEST}`]: APP_DEST,
[`${APP_BASE}node_modules`]: 'node_modules',
};
if (APP_BASE !== '/') {
routes[`${APP_BASE}`] = APP_DEST;
baseDir = `${DIST_DIR}/empty/`;
}
browserSync({
port: PORT,
startPath: APP_BASE,
server: {
baseDir: baseDir,
middleware: [
/* Connect to localhost backend server. */
proxy({
protocol: 'http:',
hostname: 'localhost',
port: 3000,
pathname: '/api',
route: '/api'
}),
/* Connect to Heroku backend server. */
// proxy({
// protocol: 'https:',
// hostname: 'powerful-lowlands-67740.herokuapp.com',
// //port: ,
// pathname: '/api',
// route: '/api'
// }),
require('connect-history-api-fallback')({ index: `${APP_BASE}index.html` })
],
routes: routes
}
});
};
开发者ID:shaggyshelar,项目名称:angular2-seed,代码行数:44,代码来源:code_change_tools.ts
示例6: function
module.exports = function (app: any, passport: any) {
var router = express.Router();
post(router, passport);
pages(router);
if (process.env.NODE_ENV === 'development') {
let base = path.join(__dirname, "..", "..", "assets");
console.log("Base : " + base);
//console.log(__dirname);
let server = new WebpackDevServer(webpack(config), {
contentBase: base,
hot: true,
quiet: false,
noInfo: false,
publicPath: "/bundle/",
stats: { colors: true }
});
server.listen(8081, "localhost", function () { });
app.use('/bundle', proxy(url.parse('http://localhost:8081/bundle')));
}
app.use('/', router);
};
开发者ID:mortonprod,项目名称:CleaningWebsite,代码行数:22,代码来源:index.ts
注:本文中的proxy-middleware.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论