Skip to content

Commit

Permalink
I removed the enable cors feature. I then added the abilitiy to accep…
Browse files Browse the repository at this point in the history
…t user input for words to be defined.
  • Loading branch information
DaneeTheDeveloper committed Jan 15, 2021
1 parent 6b0eeaf commit 977efa4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
9 changes: 3 additions & 6 deletions src/DictionaryBackend/DefinitionResult.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System.Collections.Generic;
using System.Web.Http.Cors;
// using Microsoft.AspNetCore.Cors;
using System.Console;
using Microsoft.AspNetCore.Cors;

namespace Dictionary
{


[EnableCors(origins: "http://mywebclient.azurewebsites.net", headers: "*", methods: "*")]
public class Result {
public class Result
{
public string definition { get; set; }
public string partOfSpeech { get; set; }
public List<string> synonyms { get; set; }
Expand Down
25 changes: 25 additions & 0 deletions src/DictionaryBackend/Dictionary.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.808.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dictionary", "Dictionary.csproj", "{09568224-1FB2-4FFB-9BBF-053049E9881D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{09568224-1FB2-4FFB-9BBF-053049E9881D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09568224-1FB2-4FFB-9BBF-053049E9881D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09568224-1FB2-4FFB-9BBF-053049E9881D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09568224-1FB2-4FFB-9BBF-053049E9881D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {52AD6103-3091-4135-821F-FF994559A9DC}
EndGlobalSection
EndGlobal
12 changes: 6 additions & 6 deletions src/DictionaryBackend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
using System.Threading.Tasks;
using System.Net.Http;
using System.Text.Json;
using System.Web.Http.Cors;


namespace Dictionary
{
class Program
{
static async Task Main(string[] args)
{
// EnableCorsAttribute cors = new EnableCorsAttribute("*", "*", "*");
// config.EnableCors(cors);

var client = new HttpClient();
client.BaseAddress = new Uri("https://wordsapiv1.p.rapidapi.com");
client.DefaultRequestHeaders.Add("X-Mashape-Key", "YourKey");

var wordToDefine = "Bicycle";
client.DefaultRequestHeaders.Add("X-Mashape-Key", "1bc55635edmsh5d5800c31204366p15f03djsneb5918e71ce9");

Console.WriteLine("Enter word to look up!");
var wordToDefine = Console.ReadLine();

try
{
var response = await client.GetAsync("/words/" + wordToDefine);
Expand Down

0 comments on commit 977efa4

Please sign in to comment.