-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up VSCode
In some circumstances you may want to use 3rd part IDE such as Microsoft Visual Studio Code for your scripts creation. The thing is that you will need all type definitions to have hints and autocompletions working.
We presume that you already have VSCode, Node.js and npm, so you need to complete just couple of steps listed below:
- Install TypeScript if you don't have it installed yet:
npm install -g typescript
- Create your workspace at VSCode and create empty file
definitions.d.ts
:
- Log in to
PerfOps panel
and proceed to FlexBalancers page. You need to find out your personal publicId. It can be seen when you create new flexbalancer. Just write it down.
-
Open https://panel.perfops.net/users/YOUR_PUBLIC_ID/flexbalancers/custom/definitions.d.ts page, in my case it is
https://panel.perfops.net/users/0b62ec/flexbalancers/custom/definitions.d.ts
-
You will see list of your personal definitions:
declare interface ICityResponse {
readonly name: string;
readonly geonameId: number;
}
declare interface IStateResponse {
readonly name: string;
readonly isoCode: TState;
readonly geonameId: number;
}
declare interface ICountryResponse {
readonly name: string;
readonly isoCode: TCountry;
readonly geonameId: number;
}
...
declare function onRequest(request: IRequest, response: IResponse);
Select them all, Copy and Paste all that lines to that definitions.d.ts
file that you have created at your workspace. Save the file.
Now all hints related to types and functions are enabled, you can start writing your code!
Create your first FlexBalancer
- Case 1.1: Provider Availability with Weights.
- Case 1.2: Availability based on Monitor Uptime.
- Case 2.1: Balancing based on the CDN with the better Performance.
- Case 3.1: Geolocation with excluded country.
- Case 3.2: The specific answer for the specific region.
- Case 3.3: The provider with the best performance for visitor's country.
- Case 4.1: Using country-based answers from remote sources.