locked
The SPA Process. RRS feed

  • Question

  • User1421620300 posted

    Could someone show me the process to easily formulate an MVC SPA application. I am having a hard time getting to grips on how to establish functionality based on layout page and rendering appropriate views for navigation. I have searched resources and YouTube and cant find anything all for the exception of built in templates which i do not want to use. Thanks. Markus

    Tuesday, December 11, 2018 2:12 PM

Answers

  • User-474980206 posted

    a SPA application is javascript application. MVC would only be used to support ajax calls from the javascript application.  MVC would also host the index.html page that is the javascript application and its resource files (css, images, javascript)

    SPA applications use browser api for routing and do not call the server for pages.  Generally you would pick a javascript framework to build your SPA application, say react, vue or angular. these frameworks have build tools that build the javascript and index.html files your MVC site will host.   

    ##create react spa
    npx create-react-app myapp
    cd myapp
    npm start
    
    ## create vue spa
    npm install -g @vue/cli
    vue create myapp
    ## answer questions
    cd myapp
    npm run serve
    
    ## create angular spa
    npm install -g @angular/cli
    ng new myapp
    cd myapp
    ng serve 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 11, 2018 4:44 PM
  • User-474980206 posted
    Almost all spa projects are built using the node tool chain. Angular uses typescript, and node is required to transpile the typescript to JavaScript. The angular cli is written in node.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 12, 2018 3:24 PM

All replies

  • User-474980206 posted

    a SPA application is javascript application. MVC would only be used to support ajax calls from the javascript application.  MVC would also host the index.html page that is the javascript application and its resource files (css, images, javascript)

    SPA applications use browser api for routing and do not call the server for pages.  Generally you would pick a javascript framework to build your SPA application, say react, vue or angular. these frameworks have build tools that build the javascript and index.html files your MVC site will host.   

    ##create react spa
    npx create-react-app myapp
    cd myapp
    npm start
    
    ## create vue spa
    npm install -g @vue/cli
    vue create myapp
    ## answer questions
    cd myapp
    npm run serve
    
    ## create angular spa
    npm install -g @angular/cli
    ng new myapp
    cd myapp
    ng serve 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 11, 2018 4:44 PM
  • User1421620300 posted

    Thanks for the info Bruce. But it seems as though you are using npm project. I am still trying to learn SPA in Angular in MVC project. How can adding these files from CLI help any? Markus.

    Wednesday, December 12, 2018 2:15 PM
  • User-474980206 posted
    Almost all spa projects are built using the node tool chain. Angular uses typescript, and node is required to transpile the typescript to JavaScript. The angular cli is written in node.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 12, 2018 3:24 PM