I have nodejs api:
export const applyitem = (req,res)=>{
const { id } = req.params;
const applyitems = JSON.parse(JSON.stringify(itemData));
const founditem = applyitems.find((item) => item.itemId == id);
res.send(founditem);
}
I have a c# program making use of "Restsharp" nuget package to get data from node js:
using RestSharp;
public class Program
{
static void Main(string[] args)
{
string url = "http://localhost:5000/applyitem";
var aclient = new RestClient(url);
var arequest = new RestRequest();
var response = aclient.Get(arequest);
Console.WriteLine(response.Content.ToString());
Console.ReadKey();
}
}
Currently applyitem gets called from my angular code. I want nodejs to fire an event like whenever applyitem is called from angular to nodejs , c# should get notified and the latest item should be sent to c# code. How to achieve this?