Created
March 29, 2017 09:39
-
-
Save ahelland/44d540ae5846f145c93ead96b0fe37b0 to your computer and use it in GitHub Desktop.
API Playground - loadGet Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadGet() { | |
document.getElementById("csxEditor").innerHTML = ""; | |
var strGetTemplate = [ | |
'using System;', | |
'using System.Net.Http;', | |
'\npublic class HelloAPI', | |
'{', | |
'\tpublic static void Main()', | |
'\t{', | |
'\t\tusing (var client = new HttpClient())', | |
'\t\t{', | |
'\t\t\tstring requestUrl = $\"https://api01.contoso.local/api/HttpGET?name=Azure\";', | |
'\t\t\tHttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl);', | |
'\t\t\tHttpResponseMessage response = client.SendAsync(request).Result;', | |
'\t\t\tvar responseString = response.Content.ReadAsStringAsync().Result;', | |
'\t\t\tConsole.WriteLine(responseString);', | |
'\t\t}\n\t}\n}', | |
]; | |
window.editor = monaco.editor.create(document.getElementById('csxEditor'), { | |
value: strGetTemplate.join('\n'), | |
language: 'csharp', | |
wrappingColumn: '0', | |
wrappingIndent: 'indent' | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment