I want to build an application for web and also for android. The application will have a database, and users should be able to login and perform some actions.
In Symfony2 documentation you can find all the information about how to create a web site, also there is information about how to create a symfony2 REST API.
However it is not clear for me, how to create a symfony2 web site that consumes a symfony2 REST API, and also (as it is a web service) be able to use the same REST API to consume from my android app
Any idea will be really appreciated
I am new using symfony2
Thanks
You can build your REST API easily with FOSRestBundle. There is a nice tutorial on the subject here.
In building your website, you have some options.
You can query the database directly in your controllers.
You can query your REST API in your controllers using cURL.
You can query your REST API in your views use jQuery or just AJAX.
Related
Asking for your input. I have created a project athrough ASP.NET - CRUD with EntityFramework
We have to use Azure services for deployment.
This is my setup:
Created Azure SQL database.
Completed the table for the data to be stored (name, age etc.)
Create ASP.NET API and scaffold. Success. Was able to view my data on the localhost.
Created AZURE web app service and publish my API. Checking the url its working so okay.
Completed ASP.NET MVC, called my deployed API app service. Modified controllers, models and views for my webform.
Created AZURE web app service and publish my MVC. So working CRUD, success retrieval of data.
So now working on uploading image.
How will I incorporate the uploading of image for my user(for ex those who will check my project) using blob. Do I need to add the step during my creation of API since I scaffold it? I'm now confused about how I can include my image retrieval from blob storage in my setup or workflow. I just able to work in my crud and still studying for image retrieval.
I have seen tutorials with regards to incorporating blob in asp.net. The problem is that they have only this image upload function in their example. My case is I do want to incorporate it with my CRUD.
Thank you very much for your help.
Do I need to add the step during my creation of API since I scaffold it?
Asp.Net Core's scaffolding won't automatically help you integrate azure blob-related feature code.
If you want to use the relevant code in the auzre blob in the scaffolding, you need to combine the SDK or restapi to implement it yourself.
I want to create a new project in Firebase and create new android App and download there google-service.json file. Everything Using programmatically. I tried to login with third party credentials after that what to do understand.
Can this happens?
Firebase has a REST API for creating and managing projects. Since it's REST based, it can be called from any platform that can make HTTP calls (including .NET).
For more information on this API, see the documentation for the Firebase Management API.
What I am trying to achieve:
I currently have mobile apps on top of services and would like to add a web site on top of the same services.
Services details:
ASP.NET Web API project using OAuth (bearer token) and Identity for authentication and authorisation.
Microsoft.AspNet.WebApi 5.2.3
Microsoft.Owin.Security.OAuth 3.0.1
Microsoft.AspNet.Identity.Core 2.2.1
Mobile details:
Xamarin projects.
Xamarin.Forms 2.3.3.193
What architecture should I use for the web site?
Create a new ASP.NET MVC project and call my current services from the MVC controllers? This seems bad because:
I would have 2 layers of controllers (web site MVC controllers calling services API controllers)
I would need to store bearer tokens in cookies
I would need to manage the tokens and cookies expirations
Create a new ASP.NET MVC project and call current services database directly? This seems bad because:
I would have to duplicate the models in the services project and in the web site project
Create a new ASP.NET project and call my current services using ajax? This seems bad because:
I would need to create my own register/login pages
I would need to store bearer tokens in cookies
I would need to manage the tokens and cookies expirations
I would need to say bye to future social authentication (OAUTH2) implementation because I wouldn’t be using OWIN
Thanks,
fcorbeil
If you already have the API a brand new MVC app shouldn't be such a bad choice. If you have your models stored in a different project just reference them to the MVC one. As for the services, them would work perfectly with the new application. This all can be achieved without changing almost nothing to the current implementation.
I am working on a project and using a similar architecture.
I decided to create an Angular project for the website front end and all it does is talk to the Web API. Angular handles the JWT authentication really well. If you've never worked with Angular before, it is really nice to work with.
However, a vanilla ASP.NET MVC web app would work just as well.
It depends on how comfortable you are with Angular, or how willing you are are to learning it! :)
I am trying to understand the concept of one asp.net. I did the entire exercise here.
Its easy.
Now trying to understand further, I created a new Asp.Net project and selected Web API template as follows. So we see that MVC and Web API check boxes are selected.
If I observe the project The AccountController is an ApiController and so the views folder does not have any Account and Manage folders as expected.
Now my question is how do I add an Mvc Account controller to the above project? I very well know that if I select MVC in the new project dialog as follows I can get that.
What I want is to add is an MVC account controller along with the views exactly like the following in the Web api project show earlier.
This should be very easy I guess. So could someone please describe some steps? Like for example, which model and context we need to select on add scaffold and then Add Controller dialogs?
In other words I want to understand looking at a controller say AccountController be it Api or Mvc, how do I understand what is the model class and Data context associated with it.
The plenty of scafold templates that exists are very useful to have an application running. Even you can create a new WepApplication project and add the Nuget package AspNet.Identity Sample, wich has a lot of features.
However for your project, I recommend you to start with and Empty Web Api project and then start adding only the stuff that you need. This way you will understand better how your Wep Api works with AspNet Identity (Account Management, External Login Providers like Google or Facebook, ...).
This Step by Step tutorial (and the next series) will guide you in implementing and understanding the Web Api and AspNet Identity starting from an Empty Web Api project.
Hope this helps.
Note: Just learning Identity so please bear with me. We are developing a Web API for use by apps that we build and apps built by our clients. I have the local engine working the way I want so that any "client" app could use our API to login in.
What I cannot seem to get to work is external login providers without being presented with a login page. Is it possible to converse with them in API only mode or is this type of setup out of the question? What I don't want our client's apps to have to do is know how to manage the logins to use our API.
I know this may be similar to a few other questions out there but I do not see one with our particular need.
Thanks,
Paul Speranza
If your api needs to have authentication in place then you would need some kind of registering done by the consumers of your api. But you could provide seamless ways to integrate login by not providing any additional form requirements from the client application. Popular login methods today are using social networks. Web api does support out of the box support for integrating with the social networks.
You can find a sample for using facebook authentication here