weixin_33716941 2013-06-20 14:14 采纳率: 0%
浏览 34

没有模板的Expressjs

I am looking to develop an web application which is basically one page and I am little confused regarding two things.

  • Now I am little confused as to what should my response from server-side(i.e node.js) be? I wanted to mostly response with json and then render them in client-side using javascript templates but one more option is to to render templates from server-side itself and just let the client javascript just load it and put into place.

What are the advantages and dis-advantages of each of the methods?(speed is a criteria I would value a lot).

  • And should I send json from browser using ajax to the server or built forms and send forms?. I am leaning towards json but still wanted to know which one would be better.

You can be descriptive in your answer.

Help me. Thanks.

  • 写回答

1条回答 默认 最新

  • YaoRaoLov 2013-06-20 15:14
    关注

    I think the debate is the same for Node.js than for any other tech.

    With a classic MVC solution and server side template, all the computation is made server side and pure HTML is sent to the client. The response could take longer but the browser, and the client computer, are not heavily used. It's easiest to maintain if you are not confident in client side Javascript. I think it would be easiest as well for caching.

    On the other side, the match up solution, made generally by calling API with Ajax, put more heavy computation on the client browser and leave your server globally alone. You can even think about a full static page for example that populate his content only with JavaScript. You have to be more confident with JavaScript (And use stuff like Angular.js for example). The response will be faster but the user experience will be different from a client point of you. So you will have to put more efforts on the design.

    This second solution let you choose another technology for the API. And you will find lots of help for both.

    But I would say that neither of those solution are radically faster than the other (Depending of what you do), but it's a matter of the user you have (JavaScript might be better handled in a recent browser) and you confidence in JavaScript.

    Though, these days, for a one page website, the trend seems to be in favour of the couple API + Ajax call.

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题