This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Cognito Stack | |
Parameters: | |
AuthName: | |
Type: String | |
Description: Unique Auth Name for Cognito Resources | |
Resources: | |
# Creates a role that allows Cognito to send SNS messages | |
SNSRole: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="http://localhost:3001/public/embed/index.f175bcb....css" rel="stylesheet" /> | |
<link href="http://localhost:3003/public/embed/index.3775bcg....css" rel="stylesheet" /> | |
<link href="http://localhost:3005/public/embed/index.5575bcf....css" rel="stylesheet" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import MicroFrontends from './microfrontends'; | |
import './app.css'; | |
export default function App() { | |
return ( | |
<div className="app"> | |
<header className="app__header"> | |
<h1 className="app__logo">Mi<strong>Songs</strong></h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ErrorBoundary extends Component { | |
//... | |
componentDidCatch(error, info) { | |
this.setState({ hasError: true }); | |
} | |
render() { | |
return this.state.hasError | |
? ( | |
<div> | |
<p className="alert alert-warning"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SongsContainer extends Component { | |
render() { | |
// ... | |
return ( | |
<ErrorBoundary> | |
<Songs artist={artist} songs={songs} /> | |
</ErrorBoundary> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SongsContainer extends React.Component { | |
componentDidMount() { | |
window.addEventListener(ARTISTS_SELECT_ARTIST, this.fetchSongs); | |
this.fetchSongs({ detail: { artist: this.state.artist } }); | |
} | |
componentWillMount() { | |
window.removeEventListener(ARTISTS_SELECT_ARTIST, this.fetchSongs); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
class ArtistsListItem extends React.Component { | |
onClick = (e) => { | |
//... | |
window.dispatchEvent( | |
new CustomEvent(ARTISTS_SELECT_ARTIST, { detail: { artist: name } }) | |
); | |
} | |
render() { | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function loadScript(url, name) { | |
let promise; | |
if (_scriptCache.has(url)) { | |
promise = _scriptCache.get(url); | |
} else { | |
promise = new Promise((resolve, reject) => { | |
let script = document.createElement('script'); | |
script.onerror = event => reject(new Error(`Failed to load '${url}'`)); | |
script.onload = resolve; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Generates { js: 'path/to/index.[hash].js', css: 'path/to/index.[hash].css' } | |
* based on files available in /public/embed directory | |
*/ | |
function getPathToEmbedAssets() {} | |
/** | |
* Exposes paths to embed assets | |
*/ | |
app.get('/api/embed-assets', (req, res) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
mode: 'production', | |
entry: `../client/src/embed.js`, | |
output: { | |
library: 'Artists', | |
libraryTarget: 'umd', | |
filename: 'index.[hash].js', | |
path: path.resolve(__dirname, '../server/public/embed') | |
}, | |
// ... |
NewerOlder