Giter VIP home page Giter VIP logo

single-spa's Introduction

Single-Spa

前端微服务框架

1:projectBase基本框架,功能:做各子服务的集成(类似于后端微服务的关网)。

2:projectA、projectC 为独立子服务应用(可由不同的技术栈Vue、React、Angularjs等实现),子服务应用可独立开发、测式、发布、部置。

Demo演示1:本地运行 演示一: 子服务来自远端

1:启动 projectA、projectC服务

到各子项目的根目录执行:npm run dev

2:启动 projectBase 服务

到项目的public目录打开project.config.js,注册远端子服务
到根目录执行:npm run dev

演示二: 子服务来自本地

1:打包 projectA、projectC 服务

到各子项目的根目录执行:npm run prod

2:将projectA、projectC工程下target目录中的projectA、projectC目录,考贝到projectBase工程下的modules下

3:启动 projectBase 服务

到项目的public目录打开project.config.js,注册本地子服务
到根目录执行:npm run dev

Demo演示2: Nginx上发布运行

演示一: 子服务来自远端,nginx.conf配置

演示二: 子服务来自本地,nginx.conf配置

server {
      listen       8080;
      server_name  localhost;
      charset utf-8;
      access_log  /Users/liqin/Yangjijiang/nginx/logs/access.8080.log  main;

      location / {
          root   /Users/liqin/Yangjijiang/IDEA/git/single-spa/demo/Single-SPA/projectBase/target;
          index  index.html index.htm;
          try_files $uri /index.html;
      }
      location /projectA/api/ {
          proxy_pass http://localhost:8081;
          rewrite ^/projectA/api/(.*)$ /api/$1 break;
      }
      location /projectC/passport/ {
          proxy_pass http://localhost:8082;
          rewrite ^/projectC/(.*)$ /$1 break;
      }

      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   html;
      }
 }

single-spa's People

Contributors

yangjijiang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.