├── .gitignore
├── README.md
├── client
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
├── src
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── Routes.js
│ ├── components
│ │ ├── AboutPage.js
│ │ ├── Card.js
│ │ ├── HomePage.js
│ │ ├── ProductPage.js
│ │ └── componentMapper.js
│ ├── context
│ │ └── Config.js
│ ├── index.css
│ ├── index.js
│ ├── logo.svg
│ ├── serviceWorker.js
│ ├── services
│ │ ├── axiosSetup.js
│ │ └── config.service.js
│ └── setupTests.js
└── yarn.lock
├── db
└── configs.json
├── model
└── config.model.js
├── package-lock.json
├── package.json
└── server.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 |
6 | # Compiled binary addons (https://nodejs.org/api/addons.html)
7 | build/Release
8 |
9 | # Dependency directories
10 | node_modules/
11 |
12 | # Optional npm cache directory
13 | .npm
14 |
15 | # Optional eslint cache
16 | .eslintcache
17 |
18 | # Output of 'npm pack'
19 | *.tgz
20 |
21 | # dotenv environment variables file
22 | variables.env
23 | .env
24 | .env.production
25 | .env.staging
26 | .env.test
27 | .env-cmdrc.json
28 |
29 | # Build
30 | /client/build
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Multi Tenant React App
2 |
3 | Hello all!
4 |
5 | This repo contains a Multi Tenant React App. It is currently in progress and I am explaining each stage in a series of blog posts.
6 |
7 | The following is the list of post currently available and in progress:
8 |
9 | - [Part 1: Setup](https://delvalle.dev/posts/multi-tenant-react-app-part-1/multi-tenant-react-app-part-1/)
10 | - [Part 2: Dynamic Routes](https://delvalle.dev/posts/multi-tenant-react-app-part-2/multi-tenant-react-app-part-2/)
11 | - [Part 3: Customizable Components](https://delvalle.dev/posts/multi-tenant-react-app-part-3/multi-tenant-react-app-part-3/)
12 |
13 | If you want to run this app just clone the repo, install both the server and client dependencies and run each separately. More info on this in the first post.
14 |
15 | Follow me on [Twitter](https://twitter.com/jdelvx)
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/client/README.md:
--------------------------------------------------------------------------------
1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2 |
3 | ## Available Scripts
4 |
5 | In the project directory, you can run:
6 |
7 | ### `yarn start`
8 |
9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11 |
12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console.
14 |
15 | ### `yarn test`
16 |
17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19 |
20 | ### `yarn build`
21 |
22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance.
24 |
25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed!
27 |
28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29 |
30 | ### `yarn eject`
31 |
32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33 |
34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35 |
36 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37 |
38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39 |
40 | ## Learn More
41 |
42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43 |
44 | To learn React, check out the [React documentation](https://reactjs.org/).
45 |
46 | ### Code Splitting
47 |
48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49 |
50 | ### Analyzing the Bundle Size
51 |
52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53 |
54 | ### Making a Progressive Web App
55 |
56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57 |
58 | ### Advanced Configuration
59 |
60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61 |
62 | ### Deployment
63 |
64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65 |
66 | ### `yarn build` fails to minify
67 |
68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
69 |
--------------------------------------------------------------------------------
/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "client",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^4.2.4",
7 | "@testing-library/react": "^9.3.2",
8 | "@testing-library/user-event": "^7.1.2",
9 | "axios": "^0.19.2",
10 | "react": "^16.13.1",
11 | "react-dom": "^16.13.1",
12 | "react-router-dom": "^5.1.2",
13 | "react-scripts": "3.4.1"
14 | },
15 | "scripts": {
16 | "start": "react-scripts start",
17 | "build": "react-scripts build",
18 | "test": "react-scripts test",
19 | "eject": "react-scripts eject"
20 | },
21 | "eslintConfig": {
22 | "extends": "react-app"
23 | },
24 | "browserslist": {
25 | "production": [
26 | ">0.2%",
27 | "not dead",
28 | "not op_mini all"
29 | ],
30 | "development": [
31 | "last 1 chrome version",
32 | "last 1 firefox version",
33 | "last 1 safari version"
34 | ]
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dlvx/multi-tenant-react-app/36039c517a8f2abec93bd4913d99ecf5f7ce5e68/client/public/favicon.ico
--------------------------------------------------------------------------------
/client/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 | You need to enable JavaScript to run this app.
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dlvx/multi-tenant-react-app/36039c517a8f2abec93bd4913d99ecf5f7ce5e68/client/public/logo192.png
--------------------------------------------------------------------------------
/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dlvx/multi-tenant-react-app/36039c517a8f2abec93bd4913d99ecf5f7ce5e68/client/public/logo512.png
--------------------------------------------------------------------------------
/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 | import { getConfig } from './services/config.service';
5 | import Routes from './Routes';
6 | import ConfigContext from './context/Config';
7 |
8 | function App() {
9 |
10 | const [config, setConfig] = useState({ loading: true, data: {} });
11 |
12 | const { loading, data } = config;
13 |
14 | useEffect(() => {
15 | async function getConfigAsync(){
16 | const { data } = await getConfig();
17 | setConfig({ loading: false, data });
18 | }
19 |
20 | getConfigAsync();
21 | }
22 | , []);
23 |
24 | return (
25 |
26 |
27 | {
28 | loading &&
29 | }
30 | {
31 | data.error &&
'Error getting config from server'
32 | }
33 |
34 |
35 |
36 |
37 |
38 | );
39 | }
40 |
41 | export default App;
42 |
--------------------------------------------------------------------------------
/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | const { getByText } = render( );
7 | const linkElement = getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/client/src/Routes.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {
3 | BrowserRouter as Router,
4 | Switch,
5 | Route,
6 | NavLink
7 | } from "react-router-dom";
8 | import COMPONENTS from './components/componentMapper';
9 |
10 | const DEFAULT_ROUTES = {
11 | about: {
12 | path: "/about",
13 | component: "AboutPage"
14 | },
15 | }
16 |
17 | function Routes({ routes: customRoutes }) {
18 |
19 | const routes = {...customRoutes, ...DEFAULT_ROUTES};
20 |
21 | return (
22 |
23 |
24 |
25 |
26 | Home
27 |
28 |
29 | About
30 |
31 |
32 |
33 |
34 | {
35 | Object.keys(routes).map((key) => {
36 | const route = routes[key];
37 | const Component = COMPONENTS[route.component];
38 | return (
39 |
43 |
44 |
45 | )
46 | })
47 | }
48 |
49 |
50 | );
51 | }
52 |
53 | Routes.defaultProps = {
54 | routes: DEFAULT_ROUTES
55 | }
56 |
57 | export default Routes;
58 |
--------------------------------------------------------------------------------
/client/src/components/AboutPage.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | function AboutPage() {
4 |
5 | return (
6 |
7 | This is the About page
8 |
9 | );
10 | }
11 |
12 | export default AboutPage;
--------------------------------------------------------------------------------
/client/src/components/Card.js:
--------------------------------------------------------------------------------
1 | import React, { useContext } from 'react';
2 | import ConfigContext from '../context/Config';
3 |
4 | function Card({ title, description, img }) {
5 |
6 | const { components: { card }} = useContext(ConfigContext);
7 | const { showHeader, showImage, showFooter } = card;
8 |
9 | return (
10 |
11 | {
12 | showHeader && (
13 |
14 |
15 | {title}
16 |
17 |
18 | )
19 | }
20 | {
21 | showImage && (
22 |
23 | )
24 | }
25 | {
26 | showFooter && (
27 |
28 |
29 | {description}
30 |
31 |
32 | )
33 | }
34 |
35 | );
36 | }
37 |
38 | export default Card;
--------------------------------------------------------------------------------
/client/src/components/HomePage.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Card from './Card';
3 |
4 | const items = [
5 | {
6 | id: 'card1',
7 | title: 'First Card',
8 | description: 'Some boring description',
9 | img: "https://loremflickr.com/320/240/food?random=1"
10 | },
11 | {
12 | id: 'card2',
13 | title: 'Second Card',
14 | description: 'Some boring description',
15 | img: "https://loremflickr.com/320/240/food?random=2"
16 | },
17 | {
18 | id: 'card3',
19 | title: 'Third Card',
20 | description: 'Some boring description',
21 | img: "https://loremflickr.com/320/240/food?random=3"
22 | }
23 | ]
24 |
25 | function HomePage({ items }) {
26 |
27 | return (
28 |
29 | Welcome to the Home Page!
30 |
31 | {
32 | items.map((item) => (
33 |
34 | ))
35 | }
36 |
37 |
38 | );
39 | }
40 |
41 | HomePage.defaultProps = {
42 | items
43 | }
44 |
45 | export default HomePage;
46 |
--------------------------------------------------------------------------------
/client/src/components/ProductPage.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Card from './Card';
3 |
4 | const items = [
5 | {
6 | id: 'card0',
7 | title: 'Featured Product',
8 | description: 'Interesting description',
9 | img: "https://loremflickr.com/320/240/food?random=0",
10 | featured: true
11 | },
12 | {
13 | id: 'card1',
14 | title: 'First Card',
15 | description: 'Some boring description',
16 | img: "https://loremflickr.com/320/240/food?random=1"
17 | },
18 | {
19 | id: 'card2',
20 | title: 'Second Card',
21 | description: 'Some boring description',
22 | img: "https://loremflickr.com/320/240/food?random=2"
23 | },
24 | {
25 | id: 'card3',
26 | title: 'Third Card',
27 | description: 'Some boring description',
28 | img: "https://loremflickr.com/320/240/food?random=3"
29 | }
30 | ]
31 |
32 | function ProductPage({ items }) {
33 |
34 | const featuredProduct = items.find((item) => item.featured === true);
35 | const relatedItems = items.filter((item) => !item.featured)
36 |
37 | return (
38 |
39 | Welcome to the Product Page!
40 |
41 |
42 |
43 |
44 |
45 |
{featuredProduct.title}
46 |
{featuredProduct.description}
47 |
48 |
49 |
50 | {
51 | relatedItems.map((item) => (
52 |
53 | ))
54 | }
55 |
56 |
57 | );
58 | }
59 |
60 | ProductPage.defaultProps = {
61 | items
62 | }
63 |
64 | export default ProductPage;
--------------------------------------------------------------------------------
/client/src/components/componentMapper.js:
--------------------------------------------------------------------------------
1 | import HomePage from './HomePage';
2 | import ProductPage from './ProductPage';
3 | import AboutPage from './AboutPage';
4 |
5 | const COMPONENTS = {
6 | 'HomePage': HomePage,
7 | 'ProductPage': ProductPage,
8 | 'AboutPage': AboutPage
9 | }
10 |
11 | export default COMPONENTS;
--------------------------------------------------------------------------------
/client/src/context/Config.js:
--------------------------------------------------------------------------------
1 | import { createContext } from 'react';
2 |
3 | const initialConfig = {
4 | name: "No name",
5 | routes: {},
6 | components: {}
7 | };
8 |
9 | const ConfigContext = createContext(initialConfig);
10 |
11 | export default ConfigContext;
--------------------------------------------------------------------------------
/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
15 | .nav-bar {
16 | width: 100%;
17 | position: fixed;
18 | top: 0;
19 | }
20 |
21 | .nav-bar ul {
22 | list-style-type: none;
23 | margin: 0;
24 | padding: 15px;
25 | display: flex;
26 | justify-content: flex-end;
27 | }
28 |
29 | .nav-bar ul li {
30 | margin: 10px;
31 | }
32 |
33 | .nav-bar ul li a{
34 | text-decoration: none;
35 | color: white;
36 | }
37 |
38 | .nav-bar ul li a.active{
39 | color: cornflowerblue;
40 | }
41 |
42 | .cards-container {
43 | display: flex;
44 | margin: 20px 0;
45 | }
46 |
47 | .card-container {
48 | width: 320px;
49 | margin: 5px;
50 | background-color: white;
51 | color: black;
52 | border-radius: 20px;
53 | box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
54 | }
55 |
56 | .card-header, .card-footer {
57 | padding: 10px;
58 | }
59 |
60 | .card-title, .card-description {
61 | margin: 0;
62 | }
63 |
64 | .card-image-rd {
65 | border-top-left-radius: 20px;
66 | border-top-right-radius: 20px;
67 | }
68 |
69 | .card-description {
70 | font-size: 18px;
71 | text-align: left;
72 | }
73 |
74 | .featured-product {
75 | display: flex;
76 | margin-top: 20px;
77 | background-color: white;
78 | color: black;
79 | border-radius: 20px;
80 | height: 240px;
81 | box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
82 | }
83 |
84 | .featured-img {
85 | border-top-left-radius: 20px;
86 | border-bottom-left-radius: 20px;
87 | }
88 |
89 | .featured-content {
90 | padding: 10px;
91 | text-align: left;
92 | }
--------------------------------------------------------------------------------
/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
14 | // If you want your app to work offline and load faster, you can change
15 | // unregister() to register() below. Note this comes with some pitfalls.
16 | // Learn more about service workers: https://bit.ly/CRA-PWA
17 | serviceWorker.unregister();
18 |
--------------------------------------------------------------------------------
/client/src/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/client/src/serviceWorker.js:
--------------------------------------------------------------------------------
1 | // This optional code is used to register a service worker.
2 | // register() is not called by default.
3 |
4 | // This lets the app load faster on subsequent visits in production, and gives
5 | // it offline capabilities. However, it also means that developers (and users)
6 | // will only see deployed updates on subsequent visits to a page, after all the
7 | // existing tabs open on the page have been closed, since previously cached
8 | // resources are updated in the background.
9 |
10 | // To learn more about the benefits of this model and instructions on how to
11 | // opt-in, read https://bit.ly/CRA-PWA
12 |
13 | const isLocalhost = Boolean(
14 | window.location.hostname === 'localhost' ||
15 | // [::1] is the IPv6 localhost address.
16 | window.location.hostname === '[::1]' ||
17 | // 127.0.0.0/8 are considered localhost for IPv4.
18 | window.location.hostname.match(
19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
20 | )
21 | );
22 |
23 | export function register(config) {
24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
25 | // The URL constructor is available in all browsers that support SW.
26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
27 | if (publicUrl.origin !== window.location.origin) {
28 | // Our service worker won't work if PUBLIC_URL is on a different origin
29 | // from what our page is served on. This might happen if a CDN is used to
30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374
31 | return;
32 | }
33 |
34 | window.addEventListener('load', () => {
35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
36 |
37 | if (isLocalhost) {
38 | // This is running on localhost. Let's check if a service worker still exists or not.
39 | checkValidServiceWorker(swUrl, config);
40 |
41 | // Add some additional logging to localhost, pointing developers to the
42 | // service worker/PWA documentation.
43 | navigator.serviceWorker.ready.then(() => {
44 | console.log(
45 | 'This web app is being served cache-first by a service ' +
46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA'
47 | );
48 | });
49 | } else {
50 | // Is not localhost. Just register service worker
51 | registerValidSW(swUrl, config);
52 | }
53 | });
54 | }
55 | }
56 |
57 | function registerValidSW(swUrl, config) {
58 | navigator.serviceWorker
59 | .register(swUrl)
60 | .then(registration => {
61 | registration.onupdatefound = () => {
62 | const installingWorker = registration.installing;
63 | if (installingWorker == null) {
64 | return;
65 | }
66 | installingWorker.onstatechange = () => {
67 | if (installingWorker.state === 'installed') {
68 | if (navigator.serviceWorker.controller) {
69 | // At this point, the updated precached content has been fetched,
70 | // but the previous service worker will still serve the older
71 | // content until all client tabs are closed.
72 | console.log(
73 | 'New content is available and will be used when all ' +
74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
75 | );
76 |
77 | // Execute callback
78 | if (config && config.onUpdate) {
79 | config.onUpdate(registration);
80 | }
81 | } else {
82 | // At this point, everything has been precached.
83 | // It's the perfect time to display a
84 | // "Content is cached for offline use." message.
85 | console.log('Content is cached for offline use.');
86 |
87 | // Execute callback
88 | if (config && config.onSuccess) {
89 | config.onSuccess(registration);
90 | }
91 | }
92 | }
93 | };
94 | };
95 | })
96 | .catch(error => {
97 | console.error('Error during service worker registration:', error);
98 | });
99 | }
100 |
101 | function checkValidServiceWorker(swUrl, config) {
102 | // Check if the service worker can be found. If it can't reload the page.
103 | fetch(swUrl, {
104 | headers: { 'Service-Worker': 'script' },
105 | })
106 | .then(response => {
107 | // Ensure service worker exists, and that we really are getting a JS file.
108 | const contentType = response.headers.get('content-type');
109 | if (
110 | response.status === 404 ||
111 | (contentType != null && contentType.indexOf('javascript') === -1)
112 | ) {
113 | // No service worker found. Probably a different app. Reload the page.
114 | navigator.serviceWorker.ready.then(registration => {
115 | registration.unregister().then(() => {
116 | window.location.reload();
117 | });
118 | });
119 | } else {
120 | // Service worker found. Proceed as normal.
121 | registerValidSW(swUrl, config);
122 | }
123 | })
124 | .catch(() => {
125 | console.log(
126 | 'No internet connection found. App is running in offline mode.'
127 | );
128 | });
129 | }
130 |
131 | export function unregister() {
132 | if ('serviceWorker' in navigator) {
133 | navigator.serviceWorker.ready
134 | .then(registration => {
135 | registration.unregister();
136 | })
137 | .catch(error => {
138 | console.error(error.message);
139 | });
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/client/src/services/axiosSetup.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios';
2 |
3 | const instance = axios.create({
4 | baseURL: `http://localhost:4000`,
5 | });
6 |
7 | export default instance;
8 |
9 |
--------------------------------------------------------------------------------
/client/src/services/config.service.js:
--------------------------------------------------------------------------------
1 | import axiosInstance from './axiosSetup';
2 |
3 | async function getConfig(){
4 | try {
5 | return await axiosInstance.get('/getConfig', {
6 | params: {
7 | clientId: process.env.REACT_APP_CLIENT_ID
8 | }
9 | });
10 | } catch(e){
11 | return e.response;
12 | }
13 | }
14 |
15 | export {
16 | getConfig
17 | }
18 |
--------------------------------------------------------------------------------
/client/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/db/configs.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "clientId": 1,
4 | "name": "Client A",
5 | "routes": {
6 | "home": {
7 | "path": "/",
8 | "component": "HomePage"
9 | },
10 | "product": {
11 | "path": "/product/:productId",
12 | "component": "ProductPage"
13 | }
14 | },
15 | "components": {
16 | "card": {
17 | "showHeader": true,
18 | "showImage": true,
19 | "showFooter": true
20 | }
21 | }
22 | },
23 | {
24 | "clientId": 2,
25 | "name": "Client B",
26 | "routes": {
27 | "home": {
28 | "path": "/",
29 | "component": "ProductPage"
30 | }
31 | },
32 | "components": {
33 | "card": {
34 | "showHeader": false,
35 | "showImage": true,
36 | "showFooter": true
37 | }
38 | }
39 | }
40 | ]
--------------------------------------------------------------------------------
/model/config.model.js:
--------------------------------------------------------------------------------
1 | const configs = require('../db/configs.json');
2 |
3 | function getClientConfig(clientId) {
4 | return configs.find(config => config.clientId == clientId);
5 | }
6 |
7 | module.exports = {
8 | getClientConfig
9 | }
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "multi-tenant-react-app",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "accepts": {
8 | "version": "1.3.7",
9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
10 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
11 | "requires": {
12 | "mime-types": "~2.1.24",
13 | "negotiator": "0.6.2"
14 | }
15 | },
16 | "ansi-regex": {
17 | "version": "4.1.0",
18 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
19 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
20 | },
21 | "ansi-styles": {
22 | "version": "3.2.1",
23 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
24 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
25 | "requires": {
26 | "color-convert": "^1.9.0"
27 | }
28 | },
29 | "array-flatten": {
30 | "version": "1.1.1",
31 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
32 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
33 | },
34 | "body-parser": {
35 | "version": "1.19.0",
36 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
37 | "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
38 | "requires": {
39 | "bytes": "3.1.0",
40 | "content-type": "~1.0.4",
41 | "debug": "2.6.9",
42 | "depd": "~1.1.2",
43 | "http-errors": "1.7.2",
44 | "iconv-lite": "0.4.24",
45 | "on-finished": "~2.3.0",
46 | "qs": "6.7.0",
47 | "raw-body": "2.4.0",
48 | "type-is": "~1.6.17"
49 | }
50 | },
51 | "bytes": {
52 | "version": "3.1.0",
53 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
54 | "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
55 | },
56 | "camelcase": {
57 | "version": "5.3.1",
58 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
59 | "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
60 | },
61 | "chalk": {
62 | "version": "2.4.2",
63 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
64 | "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
65 | "requires": {
66 | "ansi-styles": "^3.2.1",
67 | "escape-string-regexp": "^1.0.5",
68 | "supports-color": "^5.3.0"
69 | },
70 | "dependencies": {
71 | "supports-color": {
72 | "version": "5.5.0",
73 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
74 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
75 | "requires": {
76 | "has-flag": "^3.0.0"
77 | }
78 | }
79 | }
80 | },
81 | "cliui": {
82 | "version": "5.0.0",
83 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
84 | "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
85 | "requires": {
86 | "string-width": "^3.1.0",
87 | "strip-ansi": "^5.2.0",
88 | "wrap-ansi": "^5.1.0"
89 | }
90 | },
91 | "color-convert": {
92 | "version": "1.9.3",
93 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
94 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
95 | "requires": {
96 | "color-name": "1.1.3"
97 | }
98 | },
99 | "color-name": {
100 | "version": "1.1.3",
101 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
102 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
103 | },
104 | "concurrently": {
105 | "version": "5.1.0",
106 | "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.1.0.tgz",
107 | "integrity": "sha512-9ViZMu3OOCID3rBgU31mjBftro2chOop0G2u1olq1OuwRBVRw/GxHTg80TVJBUTJfoswMmEUeuOg1g1yu1X2dA==",
108 | "requires": {
109 | "chalk": "^2.4.2",
110 | "date-fns": "^2.0.1",
111 | "lodash": "^4.17.15",
112 | "read-pkg": "^4.0.1",
113 | "rxjs": "^6.5.2",
114 | "spawn-command": "^0.0.2-1",
115 | "supports-color": "^6.1.0",
116 | "tree-kill": "^1.2.2",
117 | "yargs": "^13.3.0"
118 | }
119 | },
120 | "content-disposition": {
121 | "version": "0.5.3",
122 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
123 | "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
124 | "requires": {
125 | "safe-buffer": "5.1.2"
126 | }
127 | },
128 | "content-type": {
129 | "version": "1.0.4",
130 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
131 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
132 | },
133 | "cookie": {
134 | "version": "0.4.0",
135 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
136 | "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
137 | },
138 | "cookie-signature": {
139 | "version": "1.0.6",
140 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
141 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
142 | },
143 | "cors": {
144 | "version": "2.8.5",
145 | "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
146 | "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
147 | "requires": {
148 | "object-assign": "^4",
149 | "vary": "^1"
150 | }
151 | },
152 | "date-fns": {
153 | "version": "2.11.1",
154 | "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.11.1.tgz",
155 | "integrity": "sha512-3RdUoinZ43URd2MJcquzBbDQo+J87cSzB8NkXdZiN5ia1UNyep0oCyitfiL88+R7clGTeq/RniXAc16gWyAu1w=="
156 | },
157 | "debug": {
158 | "version": "2.6.9",
159 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
160 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
161 | "requires": {
162 | "ms": "2.0.0"
163 | }
164 | },
165 | "decamelize": {
166 | "version": "1.2.0",
167 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
168 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
169 | },
170 | "depd": {
171 | "version": "1.1.2",
172 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
173 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
174 | },
175 | "destroy": {
176 | "version": "1.0.4",
177 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
178 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
179 | },
180 | "ee-first": {
181 | "version": "1.1.1",
182 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
183 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
184 | },
185 | "emoji-regex": {
186 | "version": "7.0.3",
187 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
188 | "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
189 | },
190 | "encodeurl": {
191 | "version": "1.0.2",
192 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
193 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
194 | },
195 | "error-ex": {
196 | "version": "1.3.2",
197 | "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
198 | "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
199 | "requires": {
200 | "is-arrayish": "^0.2.1"
201 | }
202 | },
203 | "escape-html": {
204 | "version": "1.0.3",
205 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
206 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
207 | },
208 | "escape-string-regexp": {
209 | "version": "1.0.5",
210 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
211 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
212 | },
213 | "etag": {
214 | "version": "1.8.1",
215 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
216 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
217 | },
218 | "express": {
219 | "version": "4.17.1",
220 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
221 | "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
222 | "requires": {
223 | "accepts": "~1.3.7",
224 | "array-flatten": "1.1.1",
225 | "body-parser": "1.19.0",
226 | "content-disposition": "0.5.3",
227 | "content-type": "~1.0.4",
228 | "cookie": "0.4.0",
229 | "cookie-signature": "1.0.6",
230 | "debug": "2.6.9",
231 | "depd": "~1.1.2",
232 | "encodeurl": "~1.0.2",
233 | "escape-html": "~1.0.3",
234 | "etag": "~1.8.1",
235 | "finalhandler": "~1.1.2",
236 | "fresh": "0.5.2",
237 | "merge-descriptors": "1.0.1",
238 | "methods": "~1.1.2",
239 | "on-finished": "~2.3.0",
240 | "parseurl": "~1.3.3",
241 | "path-to-regexp": "0.1.7",
242 | "proxy-addr": "~2.0.5",
243 | "qs": "6.7.0",
244 | "range-parser": "~1.2.1",
245 | "safe-buffer": "5.1.2",
246 | "send": "0.17.1",
247 | "serve-static": "1.14.1",
248 | "setprototypeof": "1.1.1",
249 | "statuses": "~1.5.0",
250 | "type-is": "~1.6.18",
251 | "utils-merge": "1.0.1",
252 | "vary": "~1.1.2"
253 | }
254 | },
255 | "finalhandler": {
256 | "version": "1.1.2",
257 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
258 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
259 | "requires": {
260 | "debug": "2.6.9",
261 | "encodeurl": "~1.0.2",
262 | "escape-html": "~1.0.3",
263 | "on-finished": "~2.3.0",
264 | "parseurl": "~1.3.3",
265 | "statuses": "~1.5.0",
266 | "unpipe": "~1.0.0"
267 | }
268 | },
269 | "find-up": {
270 | "version": "3.0.0",
271 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
272 | "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
273 | "requires": {
274 | "locate-path": "^3.0.0"
275 | }
276 | },
277 | "forwarded": {
278 | "version": "0.1.2",
279 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
280 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
281 | },
282 | "fresh": {
283 | "version": "0.5.2",
284 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
285 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
286 | },
287 | "get-caller-file": {
288 | "version": "2.0.5",
289 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
290 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
291 | },
292 | "has-flag": {
293 | "version": "3.0.0",
294 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
295 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
296 | },
297 | "hosted-git-info": {
298 | "version": "2.8.8",
299 | "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
300 | "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg=="
301 | },
302 | "http-errors": {
303 | "version": "1.7.2",
304 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
305 | "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
306 | "requires": {
307 | "depd": "~1.1.2",
308 | "inherits": "2.0.3",
309 | "setprototypeof": "1.1.1",
310 | "statuses": ">= 1.5.0 < 2",
311 | "toidentifier": "1.0.0"
312 | }
313 | },
314 | "iconv-lite": {
315 | "version": "0.4.24",
316 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
317 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
318 | "requires": {
319 | "safer-buffer": ">= 2.1.2 < 3"
320 | }
321 | },
322 | "inherits": {
323 | "version": "2.0.3",
324 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
325 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
326 | },
327 | "ipaddr.js": {
328 | "version": "1.9.1",
329 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
330 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
331 | },
332 | "is-arrayish": {
333 | "version": "0.2.1",
334 | "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
335 | "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
336 | },
337 | "is-fullwidth-code-point": {
338 | "version": "2.0.0",
339 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
340 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
341 | },
342 | "json-parse-better-errors": {
343 | "version": "1.0.2",
344 | "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
345 | "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
346 | },
347 | "locate-path": {
348 | "version": "3.0.0",
349 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
350 | "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
351 | "requires": {
352 | "p-locate": "^3.0.0",
353 | "path-exists": "^3.0.0"
354 | }
355 | },
356 | "lodash": {
357 | "version": "4.17.15",
358 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
359 | "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
360 | },
361 | "media-typer": {
362 | "version": "0.3.0",
363 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
364 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
365 | },
366 | "merge-descriptors": {
367 | "version": "1.0.1",
368 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
369 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
370 | },
371 | "methods": {
372 | "version": "1.1.2",
373 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
374 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
375 | },
376 | "mime": {
377 | "version": "1.6.0",
378 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
379 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
380 | },
381 | "mime-db": {
382 | "version": "1.43.0",
383 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz",
384 | "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ=="
385 | },
386 | "mime-types": {
387 | "version": "2.1.26",
388 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz",
389 | "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==",
390 | "requires": {
391 | "mime-db": "1.43.0"
392 | }
393 | },
394 | "ms": {
395 | "version": "2.0.0",
396 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
397 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
398 | },
399 | "negotiator": {
400 | "version": "0.6.2",
401 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
402 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
403 | },
404 | "normalize-package-data": {
405 | "version": "2.5.0",
406 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
407 | "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
408 | "requires": {
409 | "hosted-git-info": "^2.1.4",
410 | "resolve": "^1.10.0",
411 | "semver": "2 || 3 || 4 || 5",
412 | "validate-npm-package-license": "^3.0.1"
413 | }
414 | },
415 | "object-assign": {
416 | "version": "4.1.1",
417 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
418 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
419 | },
420 | "on-finished": {
421 | "version": "2.3.0",
422 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
423 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
424 | "requires": {
425 | "ee-first": "1.1.1"
426 | }
427 | },
428 | "p-limit": {
429 | "version": "2.2.2",
430 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz",
431 | "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==",
432 | "requires": {
433 | "p-try": "^2.0.0"
434 | }
435 | },
436 | "p-locate": {
437 | "version": "3.0.0",
438 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
439 | "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
440 | "requires": {
441 | "p-limit": "^2.0.0"
442 | }
443 | },
444 | "p-try": {
445 | "version": "2.2.0",
446 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
447 | "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
448 | },
449 | "parse-json": {
450 | "version": "4.0.0",
451 | "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
452 | "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
453 | "requires": {
454 | "error-ex": "^1.3.1",
455 | "json-parse-better-errors": "^1.0.1"
456 | }
457 | },
458 | "parseurl": {
459 | "version": "1.3.3",
460 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
461 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
462 | },
463 | "path-exists": {
464 | "version": "3.0.0",
465 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
466 | "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
467 | },
468 | "path-parse": {
469 | "version": "1.0.6",
470 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
471 | "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
472 | },
473 | "path-to-regexp": {
474 | "version": "0.1.7",
475 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
476 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
477 | },
478 | "pify": {
479 | "version": "3.0.0",
480 | "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
481 | "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
482 | },
483 | "proxy-addr": {
484 | "version": "2.0.6",
485 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
486 | "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
487 | "requires": {
488 | "forwarded": "~0.1.2",
489 | "ipaddr.js": "1.9.1"
490 | }
491 | },
492 | "qs": {
493 | "version": "6.7.0",
494 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
495 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
496 | },
497 | "range-parser": {
498 | "version": "1.2.1",
499 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
500 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
501 | },
502 | "raw-body": {
503 | "version": "2.4.0",
504 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
505 | "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
506 | "requires": {
507 | "bytes": "3.1.0",
508 | "http-errors": "1.7.2",
509 | "iconv-lite": "0.4.24",
510 | "unpipe": "1.0.0"
511 | }
512 | },
513 | "read-pkg": {
514 | "version": "4.0.1",
515 | "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz",
516 | "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=",
517 | "requires": {
518 | "normalize-package-data": "^2.3.2",
519 | "parse-json": "^4.0.0",
520 | "pify": "^3.0.0"
521 | }
522 | },
523 | "require-directory": {
524 | "version": "2.1.1",
525 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
526 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
527 | },
528 | "require-main-filename": {
529 | "version": "2.0.0",
530 | "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
531 | "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
532 | },
533 | "resolve": {
534 | "version": "1.15.1",
535 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
536 | "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
537 | "requires": {
538 | "path-parse": "^1.0.6"
539 | }
540 | },
541 | "rxjs": {
542 | "version": "6.5.4",
543 | "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz",
544 | "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==",
545 | "requires": {
546 | "tslib": "^1.9.0"
547 | }
548 | },
549 | "safe-buffer": {
550 | "version": "5.1.2",
551 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
552 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
553 | },
554 | "safer-buffer": {
555 | "version": "2.1.2",
556 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
557 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
558 | },
559 | "semver": {
560 | "version": "5.7.1",
561 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
562 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
563 | },
564 | "send": {
565 | "version": "0.17.1",
566 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
567 | "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
568 | "requires": {
569 | "debug": "2.6.9",
570 | "depd": "~1.1.2",
571 | "destroy": "~1.0.4",
572 | "encodeurl": "~1.0.2",
573 | "escape-html": "~1.0.3",
574 | "etag": "~1.8.1",
575 | "fresh": "0.5.2",
576 | "http-errors": "~1.7.2",
577 | "mime": "1.6.0",
578 | "ms": "2.1.1",
579 | "on-finished": "~2.3.0",
580 | "range-parser": "~1.2.1",
581 | "statuses": "~1.5.0"
582 | },
583 | "dependencies": {
584 | "ms": {
585 | "version": "2.1.1",
586 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
587 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
588 | }
589 | }
590 | },
591 | "serve-static": {
592 | "version": "1.14.1",
593 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
594 | "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
595 | "requires": {
596 | "encodeurl": "~1.0.2",
597 | "escape-html": "~1.0.3",
598 | "parseurl": "~1.3.3",
599 | "send": "0.17.1"
600 | }
601 | },
602 | "set-blocking": {
603 | "version": "2.0.0",
604 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
605 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
606 | },
607 | "setprototypeof": {
608 | "version": "1.1.1",
609 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
610 | "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
611 | },
612 | "spawn-command": {
613 | "version": "0.0.2-1",
614 | "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
615 | "integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A="
616 | },
617 | "spdx-correct": {
618 | "version": "3.1.0",
619 | "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz",
620 | "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==",
621 | "requires": {
622 | "spdx-expression-parse": "^3.0.0",
623 | "spdx-license-ids": "^3.0.0"
624 | }
625 | },
626 | "spdx-exceptions": {
627 | "version": "2.2.0",
628 | "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz",
629 | "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA=="
630 | },
631 | "spdx-expression-parse": {
632 | "version": "3.0.0",
633 | "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
634 | "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
635 | "requires": {
636 | "spdx-exceptions": "^2.1.0",
637 | "spdx-license-ids": "^3.0.0"
638 | }
639 | },
640 | "spdx-license-ids": {
641 | "version": "3.0.5",
642 | "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz",
643 | "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q=="
644 | },
645 | "statuses": {
646 | "version": "1.5.0",
647 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
648 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
649 | },
650 | "string-width": {
651 | "version": "3.1.0",
652 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
653 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
654 | "requires": {
655 | "emoji-regex": "^7.0.1",
656 | "is-fullwidth-code-point": "^2.0.0",
657 | "strip-ansi": "^5.1.0"
658 | }
659 | },
660 | "strip-ansi": {
661 | "version": "5.2.0",
662 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
663 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
664 | "requires": {
665 | "ansi-regex": "^4.1.0"
666 | }
667 | },
668 | "supports-color": {
669 | "version": "6.1.0",
670 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
671 | "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
672 | "requires": {
673 | "has-flag": "^3.0.0"
674 | }
675 | },
676 | "toidentifier": {
677 | "version": "1.0.0",
678 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
679 | "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
680 | },
681 | "tree-kill": {
682 | "version": "1.2.2",
683 | "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
684 | "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="
685 | },
686 | "tslib": {
687 | "version": "1.11.1",
688 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
689 | "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA=="
690 | },
691 | "type-is": {
692 | "version": "1.6.18",
693 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
694 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
695 | "requires": {
696 | "media-typer": "0.3.0",
697 | "mime-types": "~2.1.24"
698 | }
699 | },
700 | "unpipe": {
701 | "version": "1.0.0",
702 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
703 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
704 | },
705 | "utils-merge": {
706 | "version": "1.0.1",
707 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
708 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
709 | },
710 | "validate-npm-package-license": {
711 | "version": "3.0.4",
712 | "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
713 | "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
714 | "requires": {
715 | "spdx-correct": "^3.0.0",
716 | "spdx-expression-parse": "^3.0.0"
717 | }
718 | },
719 | "vary": {
720 | "version": "1.1.2",
721 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
722 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
723 | },
724 | "which-module": {
725 | "version": "2.0.0",
726 | "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
727 | "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
728 | },
729 | "wrap-ansi": {
730 | "version": "5.1.0",
731 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
732 | "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
733 | "requires": {
734 | "ansi-styles": "^3.2.0",
735 | "string-width": "^3.0.0",
736 | "strip-ansi": "^5.0.0"
737 | }
738 | },
739 | "y18n": {
740 | "version": "4.0.0",
741 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
742 | "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
743 | },
744 | "yargs": {
745 | "version": "13.3.2",
746 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
747 | "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
748 | "requires": {
749 | "cliui": "^5.0.0",
750 | "find-up": "^3.0.0",
751 | "get-caller-file": "^2.0.1",
752 | "require-directory": "^2.1.1",
753 | "require-main-filename": "^2.0.0",
754 | "set-blocking": "^2.0.0",
755 | "string-width": "^3.0.0",
756 | "which-module": "^2.0.0",
757 | "y18n": "^4.0.0",
758 | "yargs-parser": "^13.1.2"
759 | }
760 | },
761 | "yargs-parser": {
762 | "version": "13.1.2",
763 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
764 | "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
765 | "requires": {
766 | "camelcase": "^5.0.0",
767 | "decamelize": "^1.2.0"
768 | }
769 | }
770 | }
771 | }
772 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "multi-tenant-react-app",
3 | "version": "1.0.0",
4 | "description": "A multi tenant React app with server",
5 | "main": "server.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "server": "nodemon server.js"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "git+https://github.com/dlvx/multi-tenant-react-app.git"
13 | },
14 | "author": "José Del Valle",
15 | "license": "ISC",
16 | "bugs": {
17 | "url": "https://github.com/dlvx/multi-tenant-react-app/issues"
18 | },
19 | "homepage": "https://github.com/dlvx/multi-tenant-react-app#readme",
20 | "dependencies": {
21 | "concurrently": "^5.1.0",
22 | "cors": "^2.8.5",
23 | "express": "^4.17.1"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const cors = require('cors');
3 |
4 | const Config = require('./model/config.model');
5 |
6 | // Setup
7 | const PORT = process.env.SERVER_PORT || 4000;
8 | const app = express();
9 | app.use(cors());
10 |
11 | // Routes
12 | app.get('/getConfig', async function (req, res) {
13 | const { clientId } = req.query;
14 |
15 | const clientConfig = Config.getClientConfig(clientId);
16 |
17 | if(!clientConfig){
18 | res.status(404).send({ error: `Config not found for this clientId: ${clientId}` });
19 | }
20 |
21 | res.send(clientConfig);
22 | });
23 |
24 | // Run server
25 | app.listen(PORT, () => {
26 | console.log(`Server listening on ${PORT}`);
27 | });
--------------------------------------------------------------------------------