针对Web研发领域一直面临前后端耦合问题,在充分分析传统的互联网前后端Web软件开发的基础上,提出了引入Node.js作为中间层来解除前、后端之间耦合关系的新解决方案。设计了新的架构模式指导Web软件开发,从而达到提高开发效率、提升代码灵活性、明确开发人员工作职责等目的。基于此研究,真实开发了一个基于微信的图书借阅平台,并以此作为可行性检验的依据,该图书借阅平台使用微信作为前端执行环境,提供图书借阅、图书归还、图书入库、图书浏览功能。系统采用B/S架构,Node.js中间层和后端程序在服务器中运行,用户关注微信公众号后,可以通过微信聊天窗口接收服务器端讯息,也可以通过公众号菜单导航到前端界面,完成图书借阅分享操作,交互方式高效简洁。
Front-end and back-end's code coupling together is a historical problem in Web development area.In this paper,a new solution of Web development is proposed to decoupling connections between front-end and back-end,where Node.js is used as middle layer.A new architecture is also introduced to point the new way of creating web apps,which can enhance efficiency and extend flexibility of development,and make the duty of programmer more clear.To prove the feasibility of our method,a Wechat book sharing platform is developed based on this idea.The platform provides book borrowing,book returning,book checkin and book browsing functionalities and runs on Wechat environment.The platform is based on B/S architecture,and Node.js acts as middle layer on server.Users may receive notifications in Wechat's chatting interface or redirect to front-end webview page by clicking Wechat public accounts' custom menu bar,accomplishing sharing operation of book lending and borrowing,which is convenient and efficient.