ÔÚµ±½ñÊý×Ö»¯ÉÌÒµÀ˳±ÖУ¬ÍøÕ¾¹ØÓÚÆóÒµµÄÖØÒªÐÔ²»ÑÔ¶øÓ÷¡£¶øÔÚÍøÕ¾¿ª·¢ÁìÓò£¬Ç°ºó¶ËÊèÉ¢¼¼ÊõÒÑÈ»³ÉΪÖ÷Á÷Ç÷ÊÆ£¬ÎªÆóÒµÍøÕ¾´øÀ´ÁËÇ°ËùδÓеÄÓÅÊÆ¡£½ñÌ죬ÔÛÃǾÍÀ´ºÃºÃÁÄÁÄÆäÖеÄÃŵÀ£¬ÌرðÊÇÄÇЩ¿ÉÄÜÈÃÆóÒµÀ§»óµÄ¼¼ÊõÄѵãÒÔ¼°ÓÐЧµÄ½â¾ö¼Æ»®¡£
Ç°ºó¶ËÊèÉ¢£¬¾ÍÏñÊÇΪÆóÒµÍøÕ¾´òÔìÁËÒ»Ìõ¸ßЧµÄ¡°Éú²úÏß¡±¡£Ç°¶ËÈçͬ¾«ÃÀµÄ°ü×°£¬×¨×¢ÓÚΪÓû§·ºÆð³ö¼«¾ßÎüÒýÁ¦¡¢Ò×ÓõĽçÃ棬ÔËÓÃHTML¡¢CSSºÍJavaScriptµÈ¼¼Êõ£¬ÈÃÓû§ÔÚä¯ÀÀÍøվʱ¸ÐÊܵ½ÊæÊÊÓë±ã½Ý¡£ºó¶ËÔòÏñÊǼáʵµÄºǫ֧́³Ö£¬Í¨¹ýPythonµÄDjango¡¢Flask£¬JavaµÄSpringBootµÈÇ¿´ó¿ò¼Ü£¬´¦ÀíÅÓ´óµÄÒµÎñÂß¼¡¢¾«ÐÄÖÎÀíÊý¾Ý¿â²¢ÎªÇ°¶ËÌṩÎȶ¨µÄÊý¾Ý½Ó¿Ú¡£ÕâÖÖ·Ö¹¤Ð×÷ģʽ£¬²»µ«´ó´óÌá¸ßÁË¿ª·¢Ð§ÂÊ£¬»¹Ê¹µÃÍøÕ¾¸üÒ×ÓÚά»¤ºÍÀ©Õ¹£¬ÎªÆóÒµÔÚÃÍÁÒµÄÊг¡¾ºÕùÖÐÓ®µÃÏÈ»ú¡£
Äѵã1
½Ó¿ÚÉè¼ÆÓëÁªµ÷
½Ó¿ÚÊÇÇ°ºó¶Ë½»»¥µÄ½¹µã»·½Ú£¬Ëü¾ÍÏñÒ»×ùÇÅÁº£¬Ò»µ©Éè¼Æ·ºÆðÎÊÌ⣬Õû¸öÐÅϢͨ±¨¾Í»áÊÜ×è¡£¹ØÓÚÆóÒµÍøÕ¾À´Ëµ£¬²»¶ÔÀíµÄ½Ó¿Ú¿ÉÄܵ¼ÖÂÊý¾Ý´«Ê仺Âý¡¢»¨ÑùÔÓÂÒµÈ×´¿ö¡£²¢ÇÒÔÚÁªµ÷½×¶Î£¬ÓÉÓÚÇ°¶ËºÍºó¶Ë¿ª·¢½ø¶È²î±ð²½»òÕ߶ԽӿÚÀí½âÓÐÆ«²î£¬¾ÍÏñÁ½¸ö²î±ðÓïÑÔµÄÈËÔÚ½»Á÷£¬ºÜÈÝÒ×·ºÆðÎó½â¡£ºÃ±È£¬½Ó¿Ú²ÎÊýµÄÀàÐÍ¡¢Ãû³Æ·×ÆçÖ£¬Ç°¶ËË͵ÄÊý¾Ýºó¶Ë¿´²»¶®£¬ºó¶Ë»ØµÄÊý¾ÝÇ°¶ËÒ²ÎÞ·¨´¦Àí¡£
½â¾ö¼Æ»®
ÔÚ½Ó¿ÚÉè¼ÆÖ®³õ£¬Ç°ºó¶Ë¿ª·¢ÈËÔ±±ØÐë½ôÃÜÏàÖú£¬ÏñÅäºÏ´òÔìÒ»¸ö¾«ÃÜÒÇÆ÷Ò»Ñù£¬Öƶ¨³öÇåÎú¡¢ÏêϸµÄ½Ó¿ÚÎĵµ¡£Õâ¸öÎĵµÒªÏñÒ»±¾Ê¹ÓÃ˵Ã÷Ê飬º¸Ç½Ó¿ÚµÄ¹¦Ð§ÃèÊö¡¢ÇëÇóÒªÁ죨ÊÇGET¡¢POSTÕÕ¾ÉÆäËû£©¡¢ÇëÇó²ÎÊý£¨°üÀ¨ÀàÐÍ¡¢Ãû³Æ¡¢ÊÇ·ñ±ØÌîµÈϸ½Ú£©¡¢·µ»ØÊý¾Ý»¨Ñù£¨JSON¡¢XMLµÈ£©ÒÔ¼°Ö±¹ÛµÄʾÀý¡£
ÀûÓð汾¿ØÖƹ¤¾ßÖÎÀí½Ó¿ÚÎĵµ£¬°ü¹ÜÇ°ºó¶Ë¶¼ÔÚÒÀ¾Ý×îа汾ÊÂÇé¡£ÔÚÁªµ÷Àú³ÌÖУ¬½¨Á¢Í¨³©µÄÏàͬÇþµÀ£¬·ºÆðÎÊÌâÄÜѸËÙ½â¾ö¡£Í¬Ê±£¬½èÖúרҵµÄ½Ó¿Ú²âÊÔ¹¤¾ßÀ´Îª½Ó¿ÚÖÊÁ¿°Ñ¹Ø£¬È·±£ÆóÒµÍøÕ¾µÄÊý¾Ý½»»¥×¼È·ÎÞÎó¡£
Äѵã2
¿çÓòÎÊÌâ
µ±ÆóÒµµÄÇ°¶ËÒ³ÃæÓòÃûºÍºó¶ËAPIÓòÃû²î±ðʱ£¬¿çÓòÎÊÌâ¾ÍÏñÒ»¶Âǽ£¬¸ÇסÁËÊý¾ÝµÄÕý³£Á÷ͨ¡£ÕâÊÇÒòΪä¯ÀÀÆ÷³öÓÚÄþ¾²¿¼ÂÇ£¬ÏÞÖÆÁË¿çÓòÇëÇó£¬Ê¹µÃÇ°¶ËÎÞ·¨Ë³Àû»ñÈ¡ºó¶ËÊý¾Ý¡£ÔÚÇ°ºó¶ËÊèÉ¢¿ª·¢ÖУ¬ÓÈÆäÊǵ±ÆóÒµµÄÍøÕ¾ºÍºó¶ËЧÀÍ°²ÅÅÔÚ²î±ðЧÀÍÆ÷ÉÏʱ£¬¿çÓòÎÊÌâ¸üÊÇƵ·±·ºÆð¡£
½â¾ö¼Æ»®
CORS£¨¿çÓò×ÊÔ´¹²Ïí£©ÊÇÒ»°ÑÓÐЧµÄ¡°Ô¿³×¡±¡£ºó¶ËÔÚÏìӦͷÖÐÉèÖúÃÔÊÐí¿çÓòµÄ²ÎÊý£¬ÈçAccessControlAllowOrigin¡¢AccessControlAllowMethodsµÈ£¬¾ÍÄÜΪÊý¾ÝµÄ¿çÓò´«Êä·¿ªÍ¨µÀ¡£
ÊðÀíЧÀÍÆ÷Ò²ÊÇÒ»¸öÇÉÃîµÄ²½·¥¡£ÔÚÇ°¶Ë¿ª·¢Çé¿öÖУ¬ÅäÖÃÊðÀíЧÀÍÆ÷½«Ç°¶ËÇëÇóת·¢µ½ºó¶ËAPI£¬ÕâÑùÔÚä¯ÀÀÆ÷ÑÛÖУ¬ÇëÇó¾ÍÏñÊÇÔÚͬԴÇé¿öϽøÐеġ£ÔÚÉú²úÇé¿öÖУ¬Ê¹ÓÃNginxµÈЧÀÍÆ÷½øÐз´ÏòÊðÀíÅäÖ㬰ü¹ÜÆóÒµÍøÕ¾Êý¾ÝµÄÎȶ¨´«Ê䣬ÈÃÓû§ÎÞÂÛÔÚÄDZ߶¼ÄÜ˳³©»á¼û¡£
Äѵã3
Ç°¶ËÐÔÄÜÓÅ»¯
Ëæ×ÅÆóÒµ¶ÔÍøÕ¾¹¦Ð§ºÍÊÓ¾õЧ¹ûÒªÇóµÄÌá¸ß£¬Ç°¶ËÓ¦ÓñäµÃÔ½À´Ô½ÅÓ´ó£¬ÐÔÄÜÓÅ»¯Ò²¾Í³ÉÁËÒªº¦¡£´ó×ÚµÄJavaScriptºÍCSSÎļþ¾ÍÏñ¼«Öصĵ£¸º£¬»áÍÏÂýÒ³Ãæ¼ÓÔØËٶȣ¬ÈÃÓû§ÆÚ´ýʱ¼ä¹ý³¤£¬Ó°ÏìÌåÑé¡£²¢ÇÒ£¬²»¶ÔÀíµÄÒ³Ãæ½á¹¹ºÍäÖȾÂß¼»¹¿ÉÄܵ¼ÖÂÒ³Ã濨¶Ù£¬¾ÍÏñÒ»Á¾ÔÚÆéá«ÃÅ·ÉÏÐÐÊ»µÄÆû³µ£¬ÑÏÖØÓ°ÏìÓû§ä¯ÀÀÍøÕ¾µÄÊæÊʶȡ£
½â¾ö¼Æ»®
¶ÔJavaScriptºÍCSSÎļþ½øÐÐѹËõºÍºÏ²¢£¬¾ÍÏñ¸øÕâЩÎļþ¡°ÊÝÉí¡±£¬¼õÉÙÎļþÌå»ý¡£WebpackµÈÏȽøµÄ¹¹½¨¹¤¾ß¿ÉÒÔÇáËÉʵÏÖ×Ô¶¯»¯µÄѹËõºÍºÏ²¢²Ù×÷¡£
½ÓÄÉÀÁ¼ÓÔؼ¼Êõ£¬ÈÃ×ÊÔ´°´Ðè¼ÓÔØ¡£ºÃ±È£¬¹ØÓÚͼƬ½Ï¶àµÄÆóÒµ²úƷչʾҳÃ棬¿ÉÒÔÈÃͼƬÔÚ½øÈëÓû§¿ÉÊÓÇøÓòʱÔÙ¼ÓÔØ£¬ÖÆÖ¹Ò»´ÎÐÔ¼ÓÔعý¶à×ÊÔ´¡£Í¬Ê±£¬ÓÅ»¯Ò³ÃæµÄäÖȾÂß¼£¬¼õÉÙÖØÅźÍÖØ»æ²Ù×÷£¬ÈÃÓû§ÔÚä¯ÀÀÆóÒµÍøվʱ¸ÐÊܵ½ÈçË¿°ã˳»¬µÄÌåÑé¡£
Äѵã4
Êý¾ÝÒ»ÖÂÐÔ»ººÍ´æÎÊÌâ
Ç°ºó¶ËÊèÉ¢ºó£¬Êý¾ÝÔÚ¶à¸öµØ·½´æ´¢£¬¾ÍÏñÐÅÏ¢ÊèÉ¢ÔÚ²î±ðµÄ»õ²Ö£¬ÕâºÜÈÝÒ×µ¼ÖÂÊý¾Ý·×ÆçÖ¡£Ç°¶ËµÄÍâµØ»º´æ¡¢ºó¶ËµÄÊý¾Ý¿âµÈ¶¼¿ÉÄܳÉΪÊý¾Ý¡°´ò¶·¡±µÄµØ·½¡£²¢ÇÒ£¬»º´æʹÓò»µ±»¹»áÔì³ÉÊý¾Ý¸üв»ÊµÊ±£¬ÈÃÓû§¿´µ½µÄÐÅÏ¢½û¾øÈ·£¬Õâ¶ÔÆóÒµÐÎÏóºÍÒµÎñ¿ªÕ¹¶¼¿ÉÄܱ¬·¢¸ºÃæÓ°Ïì¡£
½â¾ö¼Æ»®
½¨Á¢Êý¾Ý¸üлúÖÆ£¬µ±ºó¶ËÊý¾Ý±¬·¢±ä¸ïʱ£¬ÊµÊ±Í¨ÖªÇ°¶Ë¸üлº´æ¡£WebSocketµÈʵʱͨÐż¼Êõ¾ÍÏñÒ»¸ö¸ßЧµÄ¡°´«Áî±ø¡±£¬ÄÜÈ·±£Êý¾ÝµÄʵʱͬ²½¡£
¹ØÓÚ»º´æ£¬ÒªÖƶ¨ºÏÀíµÄÕ½ÂÔ¡£Æ¾¾ÝÊý¾ÝµÄÖØÒªÐԺ͸üÐÂƵÂÊÀ´¾ö¶¨ÊÇ·ñ»º´æ¡¢»º´æ¶à¾ÃµÈ¡£Í¬Ê±£¬ÎªÆóÒµÍøÕ¾ÉèÖÃÊÖ¶¯Ë¢Ð»º´æµÄ¹¦Ð§£¬ÒÔÓ¦¶ÔÌØÊâÇé¿ö£¬°ü¹ÜÓû§¿´µ½µÄÐÅÏ¢×ÜÊÇ×îС¢×î׼ȷµÄ¡£
*ÄÚÈÝÔ´×ÔÍøÂ磬ÈçÓÐÇÖȨÇëÁªÏµÉ¾³ý