mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
24 lines
390 B
TypeScript
24 lines
390 B
TypeScript
import Koa = require('koa');
|
|
import proxy = require('koa-proxy');
|
|
|
|
const app = new Koa();
|
|
|
|
app.use(proxy({
|
|
host: 'https://api.github.com',
|
|
match: /^\/repos\//
|
|
}));
|
|
|
|
app.use(proxy({
|
|
host: 'https://api.github.com',
|
|
map: (path) => `/mapped/${path}`
|
|
}));
|
|
|
|
app.use(proxy({
|
|
host: 'https://api.github.com',
|
|
map: {
|
|
'/foo/bar': '/repos'
|
|
}
|
|
}));
|
|
|
|
app.listen(3000);
|