drw85135 2016-09-13 02:50
浏览 54

混合单页面应用程序架构(过度设计?)

Please excuse the length of this post!

I'm building a fairly complex product that consists of the following:

  1. A Web Application
  2. A Web Server w/ PHP MVC Backend
  3. Mobile Apps (iOS, Android, Windows)
  4. A REST API Server (PHP)
  5. A DB Server (MySQL)

*Note, there are no frameworks in use and on occassion jQuery is used for simplicity.

My issue lies with the web app. Out of the entire application there are maybe a dozen pages that are actually served up by the web server with some data prepopulated. The pages have tabbed navigation where content/data is displayed. Those tab sections will all load dynamically if/when the user selects the tab. For performance reasons I cannot preload all of the data and only populate it when requested.

Currently all my requests to the API from the web app are routing through the webserver where my user session is stored.

This is what request cycle would look like.

  1. Web App User requests a page
  2. Web Server calls API and populates data from API response
  3. Web Server serves requested page
  4. Web App User clicks on a tab on the page, data must now be loaded
  5. Web App sends AJAX HTTP request to web server
  6. Web server calls API requesting/receiving data
  7. Web Server sends JSON back to AJAX call
  8. Web App populates data on the tab

My question is if this is too over-engineered. I know I could skip the webserver and just call the API, but being that the API has no session management, it doesn't seem to make sense. With each call to the API I need to know if the user is logged in to allow for post, put, or delete calls, so it doesn't seem right to skip the web server.

Am I going off track here or is this the recommended approach?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了