0
I’m studying Web API and I’m having doubts about how to call an Action as soon as I click the Visual Studio play button.
I imagine this should be done in the Main method of the Program class, but I have no idea how to do this.
The ultimate goal is to get this application started and, from time to time, read the database data and send it to an endpoint of another API that I will still create.
For now, I’m in this phase of making the application start by calling an Action.
Additional information:
The project was created in Asp.Netcore 2.2
Is running locally: https://localhost:44366/
Later, I will use the Chroniton package to read the data periodically.
Strange your question because it’s clearer ...
– novic
It doesn’t make sense for a Webapi to call an action of its own... But you can run this routine at the start of the application yes at startup
– Leandro Angelo
Virgilio Novic and @Leandroangelo what I need is, once I start the API, she reads the table data from time to time and sends it to an endpoint of another API. And I’m racking my brain to know how it should be done.
– Everton Solon
@Evertonsolon From time to time? I don’t think this is appropriate... it may be the case to create another application with this unique responsibility.
– Leandro Angelo
@Leandroangelo I understand your point of view but it is what the test of the company, in which I am a candidate, is asking. Entede? rsrs
– Everton Solon