Giter Site home page Giter Site logo

micro-frontends-prototype's Introduction

Micro frontends prototype

This is a basic prototype consisting of a composer service and several micro frontend components.

Prerequisites

Node.js (Version 14 or newer) and Go have to be installed. If you want to build the react component (fourth component), yarn is required.

Set up the project

Run npm install in the root directory.

To build the react component, navigate to the respective folder cd fourth-component and run build.sh.

Run the project

Run npm start in the root directory, this will start the composer service and all components. The composer listens on localhost:9000.

Add a new component

Create a new folder with an index.js, which runs a web server on a specific port. Basic example:

import http from 'http';

const port = process.env.PORT || 9004;

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.write('<div>Hello world from component 2!</div><br />');
  res.end();
}).listen(port); 

In addition, add a new fragment to ./dom.js. The fragment number will determine the port number where the composer service will look for the component, so make sure these are matching (e.g. fragment4 and port = 9004).

If the component should be started automatically, add it to the start script in package.json.

micro-frontends-prototype's People

Contributors

maximilian5189 avatar

Stargazers

Roman avatar

Watchers

 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.