-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ts
47 lines (43 loc) · 1.03 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Options } from 'http-proxy-middleware';
import { ParsedUrlQueryInput } from 'querystring';
export interface Config {
allowedDomains: string[];
proxies: Proxy[];
}
export interface Proxy extends Options {
route: string;
allowedMethods: string[];
queryparams?: ParsedUrlQueryInput;
allowedDomains?: string[];
}
const config: Config = {
allowedDomains: ['*'],
proxies: [
{
route: '/weather',
allowedMethods: ['GET'],
target: 'https://api.openweathermap.org/data/2.5/weather',
queryparams: {
appid: process.env.WEATHER_API_KEY,
},
},
{
route: '/ipinfo',
allowedMethods: ['GET'],
target: 'https://ipinfo.io/',
queryparams: {
token: process.env.IPINFO_TOKEN,
},
},
{
route: '/github',
allowedMethods: ['GET'],
target: 'https://api.github.com',
headers: {
Accept: 'application/vnd.github.v3+json',
Authorization: `Token ${process.env.GITHUB_TOKEN}`,
},
},
],
};
export default config;