Base solution for your next web application
Open Closed

ANGULAR 1.X Projects Separation #3484


User avatar
0
moustafa created

Hello

I've been read the discussion in this post [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=9233]) and i understand your point of view , i don't deny i disappointed of your decision about your plans for Angular 1.x version as i'm a big fan of it and now i have to rewrite my application from beginning to get advantages of Angular 2.x version i know that you will continue supporting Angular 1.x as much as you can but i have one request that is not easy for me to do alone and may some members will agree with me on it like this post [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=4374&p=10413])

Projects Separation what i meant as you did in Angular 2.x which is great done by the way this issue cause me a lot of problems and i hope to solve this problems in next releases or at least provide detailed instructions to help us to do it myself

thanks


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @moustafa,

    Seperating client and server side for angular1 project is not an easy task and we are not planning to do it if that is what you are asking. We worked on Angular2 version almost 2 months. Most

    If you want to do this, most challenging part is working on AccountController. Unfortunately, we cannot provide a step by step guide for this but if you have any problems while doing it, we can share our experience.

    What is your idea about it ?

    Thanks.

  • User Avatar
    0
    moustafa created

    Hi @ismcagdas

    I know that Separation is not that easy and i'm asking you to help me with that because you got the experience as you mention from Angular 2 version so any ideas how can i do that or what point should i start with to make separation as you did in Angular 2? can you share with me your experience about that ? what if i need just to separate public website as first step ?

    thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Starting from seperating public site is a good idea, because it is easier than seperating angular client and api.

    For seperating public website, we basically created a new ASP.NET MVC project and copied necessary files including css, js (metronic theme as well) and some controllers (Home, About).

    After that, in order to login user from public website, we followed this approach: When user clicks login link on public website, redirect user to admin website with a query string parameter for single sign on: <a class="postlink" href="http://admin.website.com?ss=true">http://admin.website.com?ss=true</a>

    Then, in admin website, when user logs in, we updated users SignInToken to a guid and SignInTokenExpireTime to utc now(You will need to add this field to User, it does not exist). Then redirected back to public website with SignInToken value included in query string after login if "ss" querystring parameter exists. <a class="postlink" href="http://public.website.com?signInToken=">http://public.website.com?signInToken=</a>{token_guid_here}

    Then in public website, we get this token, query user table with this token and if we find a user, login this user on public website.

    For seperating angular client and API, you have two main work to do:

    1. Converting cshtml files to html files.
    2. Implementing login logic. This is the hardest one because login flow changes totally.

    The reason we didn't do this seperating in angular1 project is, it is very hard for us to do. Because of that we implemented it in a newly created project in angular2. That is why, we are unable to explain how to do it in angular1.

    If you don't have so much code in your project and it is not in production, moving your code to angular2 version might be easier.

    Thanks.

  • User Avatar
    0
    moustafa created

    Thank you for your help

    for public website separation i almost get the idea but what about the project web.host that responsible for hosting API do i need to create public website (separated one) in the same solution or in different solution , so what about the existing one ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We did put the public website in the same solution and deleted the public website part from admin website.

    For host project, it will be your current MVC application. First thing, you should to to move from cookie based auth to token based auth. Because cookies are not shared between different domains. You also can create a seperate project for your Angular1 client side and start to work on Login scenarios.

    Thanks.