![]() This way I don’t have to write localhost:5001/api/WebScraper in the address bar, localhost:5001/WebScraper will do. ![]() Instead of Route("api/") I’m going to specify Route(""). Lets open it up! using System using using System.Linq using using using namespace website_scraper.Controllers Īdditionally I’m going to alter the route specified in the controller. The last command creates a new controller in the “Controllers” folder called “WebScraperController”. A tool we need for code generation dotnet add package .Design // The command that generates our controller dotnet aspnet-codegenerator controller -name WebScraperController -async -api -outDir Controllers NET core has CLI tools for that (don’t need VS, I’m all for that!). This will create a new project folder and setup a basic controller.īefore dealing with AngleSharp let us first create a new controller so we can actually see something we wrote on the screen. NET we run dotnet new webapi -o web_scraper. If you don’t have any other timing mechanism you can use the CLI to generate a basic windows service which will run in the background and make requests to your scraping target. I’m going to use dotnet CLI to create a simple “webapi” which I can later put live and ping on some interval from another web app which will handle the timing. The code is going to be quite simple and you won’t need a special environment to run it, so you have many options really. You can even add controllers and models using the CLI and get the code generation utilities you would get in Visual Studio, but on the command line (meaning you could probably create integrated tools for whatever editor you’re using). Luckily we can skip it! The dotnet CLI tools are quite simple to use and well documented (□). If you’re like me, then Visual Studio gives you a migraine, so I definitely want to skip using it whenever I can. In the future I might make an Android app that will directly push the relevant data to my phone and might even sprinkle some machine learning on top (recommendations perhaps?), but that’s another article, or 100! Using.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |