Reputation: 920
Recently, I started looking into building server to handle HTTP requests and user authentication with ASP.NET Web API 2. I aimed at allowing my mobile client, which is built with PhoneGap, to interact with my ASP.NET server.
I followed several guides found on the web and these sample projects could be built successfully. However, every tutorial I found always included web pages in the ASP.NET project. I really want to know if it is viable to have my web pages solely stored in the client, so the server can just act as a data provider and authenticator only.
Here is a common scenario I can think of:
1. app sends a GET request to retrieve a list of items
2. server receives this GET request
3. server queries the DB and retrieves a list of items
4. server serializes the list as a JSON object and send it back to the app
5. app receives the list of items and updates the page with the new data
If the previous architecture is not viable, that means I will need to have web pages included in the server project and be compiled together with the core logic code. Is this statement correct?
Upvotes: 0
Views: 443
Reputation: 9043
Did you take look on my posts about building simple Authorization server using Web API 2 and Owin, then building client application using AngularJS?
I was strict in my post to separate between the (AuthZ server/resource server) and (front end application). Check those posts and the source code samples.
Hope this will be good start for you.
Upvotes: 2
Reputation: 765
We built an app based on Cordova using jQuery and handlebars.js for all of the UI on the device with WCF services using JSON requests/responses for all data retrieval and updating. Works great and is currently in the iOS App Store and Google Play Store so yes it is possible.
Upvotes: 0