Toast Toast - 11 months ago 65
reST (reStructuredText) Question

How should I structure .net website to use a web api?

I'm starting a project that will use a search bar to hit a web api and return the results. There will be no writing to the web api.

My biggest struggle when creating a new project is how it should be laid out. I never know when i should create a DAO, do it all via javascript, put it in a controller, etc.

Answer Source

For developing something like a search engine or any web application. You would need following:

  1. A frontend, which is your application's GUI in browser of user or mobile application.
  2. A backend logic, this could be in any server side scripting language, in your case you would be writing server code in .net

Now, your backend must expose a search api, Eg. If I send a HTTP GET with a variable q, it should return search results matching the query.

Your frontend must have input-box and a button for allowing users to send this request.

This answer isn't complete, just a vague overview of how this problem can be approached, also this isn't the only solution.