Get data from backend to Aurelia

I want to send C# List from Back-end (Asp.net Core) to Front-end (Aurelia). The app.js in Aurelia uses Babel. How to write the app.js to get the List? Is there another way other than http? Like call the c# file directly?
This is my HomeController.cs:

[Route("api/[controller]")]
	[ApiController]
	public class HomeController : Controller {

		[HttpGet("Data")]
		public Dictionary<string, object> Data() {
			var properties = new Dictionary<string, object>()
            {
               {“type”, “list”},
               {“title”, “title”},
            };

        return properties;
		}
	}
1 Like

Can you please elaborate on why you would not want to use HTTP to transfer data from server to client?

1 Like

I am okay to use HTTP, but can you tell me how?
Thanks!

1 Like

use aurelia-http-client, or aurelia-fetch-client packages to do so.

https://aurelia.io/docs/plugins/http-services

2 Likes

@adn here’s an example of how you can use http fetch with an api controller that returns JSON. I’m using async await but you can also use the old style of promises such as done().

2 Likes