├── client ├── src │ ├── index.css │ ├── config.json │ ├── App.test.js │ ├── components │ │ ├── Home.js │ │ ├── Hero.js │ │ ├── Footer.js │ │ ├── Navbar.js │ │ ├── FormErrors.js │ │ ├── Musicians.js │ │ ├── Musician.js │ │ ├── HomeContent.js │ │ ├── utility │ │ │ └── FormValidation.js │ │ └── MusiciansAdmin.js │ ├── index.js │ ├── App.css │ ├── App.js │ └── serviceWorker.js ├── public │ ├── logo.png │ ├── favicon.ico │ ├── notes-logo.jpg │ ├── manifest.json │ └── index.html ├── package.json └── README.md ├── store ├── datastore.js ├── schema.js └── data.js ├── public ├── logo.png ├── favicon.ico ├── notes-logo.jpg ├── manifest.json ├── precache-manifest.01c35f111889c6ee36dd438e939568a2.js ├── static │ ├── css │ │ ├── main.89a458fc.chunk.css │ │ └── main.89a458fc.chunk.css.map │ └── js │ │ ├── runtime~main.a8a9905a.js │ │ ├── runtime~main.a8a9905a.js.map │ │ ├── main.7aabff24.chunk.js │ │ └── main.7aabff24.chunk.js.map ├── asset-manifest.json ├── service-worker.js └── index.html ├── README.md ├── package.json ├── app.js ├── models ├── musician.js └── musician.test.js └── routes ├── musician.js └── musician.test.js /client/src/index.css: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /store/datastore.js: -------------------------------------------------------------------------------- 1 | // primary store object 2 | module.exports = {}; 3 | -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/musician-app/HEAD/public/logo.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/musician-app/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /client/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/musician-app/HEAD/client/public/logo.png -------------------------------------------------------------------------------- /client/src/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "api": { 3 | "invokeUrl": "http://localhost:3001" 4 | } 5 | } -------------------------------------------------------------------------------- /public/notes-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/musician-app/HEAD/public/notes-logo.jpg -------------------------------------------------------------------------------- /client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/musician-app/HEAD/client/public/favicon.ico -------------------------------------------------------------------------------- /client/public/notes-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/musician-app/HEAD/client/public/notes-logo.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # musician-app 2 | NodeJS / React sample app for AWS CI/CD pipeline tutorial 3 | 4 | https://www.youtube.com/watch?v=NwzJCSPSPZs 5 | -------------------------------------------------------------------------------- /client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /client/src/components/Home.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from 'react'; 2 | import Hero from './Hero'; 3 | import MusiciansAdmin from './MusiciansAdmin'; 4 | 5 | export default function Home() { 6 | return ( 7 | 8 | 9 | 10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /client/src/components/Hero.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default function Hero() { 4 | return ( 5 |
6 |
7 |
8 | Musician App 9 |
10 |
11 |
12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /store/schema.js: -------------------------------------------------------------------------------- 1 | const yup = require('yup'); 2 | 3 | module.exports = schema = yup.object().shape({ 4 | firstName: yup.string().max(50, 'Value cannot exceed 50 characters').required(), 5 | lastName: yup.string().max(50, 'Value cannot exceed 50 characters').required(), 6 | //genre: yup.string().matches(/(JAZZ|ROCK|BLUES)/).required() 7 | }); 8 | -------------------------------------------------------------------------------- /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 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /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 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /client/src/components/Footer.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | export default function Footer() { 4 | return ( 5 | 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import 'bulma/css/bulma.min.css'; 4 | import './index.css'; 5 | import App from './App'; 6 | import * as serviceWorker from './serviceWorker'; 7 | 8 | ReactDOM.render(, document.getElementById('root')); 9 | 10 | // If you want your app to work offline and load faster, you can change 11 | // unregister() to register() below. Note this comes with some pitfalls. 12 | // Learn more about service workers: https://bit.ly/CRA-PWA 13 | serviceWorker.unregister(); 14 | -------------------------------------------------------------------------------- /client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | Musician App 13 | 14 | 15 | 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs-restapi-poc", 3 | "version": "1.0.0", 4 | "description": "A NodeJS REST API poc", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "jest", 8 | "start": "nodemon app.js", 9 | "start-dev": "nodemon app.js" 10 | }, 11 | "author": "Jonathan Spruance", 12 | "license": "ISC", 13 | "dependencies": { 14 | "body-parser": "^1.18.3", 15 | "express": "^4.16.4", 16 | "winston": "^3.2.1", 17 | "yup": "^0.26.10" 18 | }, 19 | "devDependencies": { 20 | "jest": "^24.7.1", 21 | "moxios": "^0.4.0", 22 | "nodemon": "^1.18.11", 23 | "supertest": "^4.0.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /store/data.js: -------------------------------------------------------------------------------- 1 | // A collection of musicians where the key is the unique id 2 | module.exports = { 3 | coltrane: { 4 | firstName: 'John', 5 | lastName: 'Coltrane', 6 | genre: 'JAZZ', 7 | }, 8 | 9 | davis: { 10 | firstName: 'Gustav', 11 | lastName: 'Ejstes', 12 | genre: 'Rock', 13 | }, 14 | 15 | mccartney: { 16 | firstName: 'Paul', 17 | lastName: 'McCartney', 18 | genre: 'ROCK', 19 | }, 20 | 21 | hendrix: { 22 | firstName: 'Jimi', 23 | lastName: 'Hendrix', 24 | genre: 'Rock', 25 | }, 26 | 27 | cobain: { 28 | firstName: 'Kurt', 29 | lastName: 'Cobain', 30 | genre: 'Rock', 31 | }, 32 | 33 | king: { 34 | firstName: 'Bo', 35 | lastName: 'Hansson', 36 | genre: 'Rock', 37 | }, 38 | }; 39 | -------------------------------------------------------------------------------- /public/precache-manifest.01c35f111889c6ee36dd438e939568a2.js: -------------------------------------------------------------------------------- 1 | self.__precacheManifest = (self.__precacheManifest || []).concat([ 2 | { 3 | "revision": "e21257903ff1a3f9e44bb175157b9229", 4 | "url": "/index.html" 5 | }, 6 | { 7 | "revision": "4b89efbd2552c709b8c7", 8 | "url": "/static/css/2.9e4b045f.chunk.css" 9 | }, 10 | { 11 | "revision": "34b25caead993370dec9", 12 | "url": "/static/css/main.89a458fc.chunk.css" 13 | }, 14 | { 15 | "revision": "4b89efbd2552c709b8c7", 16 | "url": "/static/js/2.2f044a07.chunk.js" 17 | }, 18 | { 19 | "revision": "34b25caead993370dec9", 20 | "url": "/static/js/main.7aabff24.chunk.js" 21 | }, 22 | { 23 | "revision": "42ac5946195a7306e2a5", 24 | "url": "/static/js/runtime~main.a8a9905a.js" 25 | } 26 | ]); -------------------------------------------------------------------------------- /public/static/css/main.89a458fc.chunk.css: -------------------------------------------------------------------------------- 1 | .App{text-align:center}.App-logo{-webkit-animation:App-logo-spin 20s linear infinite;animation:App-logo-spin 20s linear infinite;height:40vmin;pointer-events:none}.App-header{background-color:#282c34;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:calc(10px + 2vmin);color:#fff}.App-link{color:#61dafb}.navbar-item img{max-height:3.3em}.musician-card{width:30%;float:left;margin-right:1em}@-webkit-keyframes App-logo-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes App-logo-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}} 2 | /*# sourceMappingURL=main.89a458fc.chunk.css.map */ -------------------------------------------------------------------------------- /client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 40vmin; 8 | pointer-events: none; 9 | } 10 | 11 | .App-header { 12 | background-color: #282c34; 13 | min-height: 100vh; 14 | display: flex; 15 | flex-direction: column; 16 | align-items: center; 17 | justify-content: center; 18 | font-size: calc(10px + 2vmin); 19 | color: white; 20 | } 21 | 22 | .App-link { 23 | color: #61dafb; 24 | } 25 | 26 | .navbar-item img { 27 | max-height: 3.3em; 28 | } 29 | 30 | .musician-card { 31 | width: 30%; 32 | float: left; 33 | margin-right: 1em; 34 | } 35 | 36 | @keyframes App-logo-spin { 37 | from { 38 | transform: rotate(0deg); 39 | } 40 | to { 41 | transform: rotate(360deg); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; 3 | import './App.css'; 4 | import Navbar from './components/Navbar'; 5 | import Home from './components/Home'; 6 | import Footer from './components/Footer'; 7 | import { library } from '@fortawesome/fontawesome-svg-core'; 8 | import { faEdit } from '@fortawesome/free-solid-svg-icons' 9 | library.add(faEdit); 10 | 11 | class App extends Component { 12 | render() { 13 | return ( 14 |
15 | 16 |
17 | 18 | 19 | 20 | 21 |
22 |
23 |
24 |
25 | ); 26 | } 27 | } 28 | 29 | export default App; 30 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const path = require('path'); 3 | const store = require('./store/datastore'); 4 | const initialStoreData = require('./store/data'); 5 | const Musician = require('./models/musician'); 6 | const musicianRoutes = require('./routes/musician'); 7 | 8 | const app = express(); 9 | const port = process.env.PORT || 3001; 10 | 11 | // include routes 12 | app.use('/musician', musicianRoutes); 13 | 14 | app.use(express.static('public')); 15 | 16 | // Index route 17 | app.get('*', (req, res) => { 18 | res.sendFile(path.join(__dirname, 'client/build/index.html')); 19 | }); 20 | 21 | // initialize store 22 | const musician = new Musician(store); 23 | musician.initStore(initialStoreData); 24 | app.locals.musician = musician; 25 | 26 | // start server 27 | const server = app.listen(port, () => { 28 | console.log("Server started on port " + port); 29 | }); 30 | 31 | module.exports = server; -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@fortawesome/fontawesome-svg-core": "^1.2.15", 7 | "@fortawesome/free-solid-svg-icons": "^5.7.2", 8 | "@fortawesome/react-fontawesome": "^0.1.4", 9 | "axios": "^0.18.0", 10 | "bulma": "^0.7.4", 11 | "react": "^16.8.6", 12 | "react-dom": "^16.8.6", 13 | "react-html-parser": "^2.0.2", 14 | "react-router-dom": "^4.3.1", 15 | "react-scripts": "3.0.0" 16 | }, 17 | "proxy": "http://localhost:3001/", 18 | "scripts": { 19 | "start": "react-scripts start", 20 | "build": "react-scripts build", 21 | "postbuild": "mv build/* ../public", 22 | "test": "react-scripts test", 23 | "eject": "react-scripts eject" 24 | }, 25 | "eslintConfig": { 26 | "extends": "react-app" 27 | }, 28 | "browserslist": [ 29 | ">0.2%", 30 | "not dead", 31 | "not ie <= 11", 32 | "not op_mini all" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /public/asset-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "main.css": "/static/css/main.89a458fc.chunk.css", 4 | "main.js": "/static/js/main.7aabff24.chunk.js", 5 | "main.js.map": "/static/js/main.7aabff24.chunk.js.map", 6 | "runtime~main.js": "/static/js/runtime~main.a8a9905a.js", 7 | "runtime~main.js.map": "/static/js/runtime~main.a8a9905a.js.map", 8 | "static/css/2.9e4b045f.chunk.css": "/static/css/2.9e4b045f.chunk.css", 9 | "static/js/2.2f044a07.chunk.js": "/static/js/2.2f044a07.chunk.js", 10 | "static/js/2.2f044a07.chunk.js.map": "/static/js/2.2f044a07.chunk.js.map", 11 | "index.html": "/index.html", 12 | "precache-manifest.01c35f111889c6ee36dd438e939568a2.js": "/precache-manifest.01c35f111889c6ee36dd438e939568a2.js", 13 | "service-worker.js": "/service-worker.js", 14 | "static/css/2.9e4b045f.chunk.css.map": "/static/css/2.9e4b045f.chunk.css.map", 15 | "static/css/main.89a458fc.chunk.css.map": "/static/css/main.89a458fc.chunk.css.map" 16 | } 17 | } -------------------------------------------------------------------------------- /client/src/components/Navbar.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | 3 | export default class Navbar extends Component { 4 | render() { 5 | return ( 6 | 31 | ) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /public/static/css/main.89a458fc.chunk.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["App.css"],"names":[],"mappings":"AAAA,KACE,iBACF,CAEA,UACE,mDAA4C,CAA5C,2CAA4C,CAC5C,aAAc,CACd,mBACF,CAEA,YACE,wBAAyB,CACzB,gBAAiB,CACjB,YAAa,CACb,qBAAsB,CACtB,kBAAmB,CACnB,sBAAuB,CACvB,4BAA6B,CAC7B,UACF,CAEA,UACE,aACF,CAEA,iBACE,gBACF,CAEA,eACE,SAAU,CACV,UAAW,CACX,gBACF,CAEA,iCACE,GACE,8BAAuB,CAAvB,sBACF,CACA,GACE,+BAAyB,CAAzB,uBACF,CACF,CAPA,yBACE,GACE,8BAAuB,CAAvB,sBACF,CACA,GACE,+BAAyB,CAAzB,uBACF,CACF","file":"main.89a458fc.chunk.css","sourcesContent":[".App {\n text-align: center;\n}\n\n.App-logo {\n animation: App-logo-spin infinite 20s linear;\n height: 40vmin;\n pointer-events: none;\n}\n\n.App-header {\n background-color: #282c34;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n font-size: calc(10px + 2vmin);\n color: white;\n}\n\n.App-link {\n color: #61dafb;\n}\n\n.navbar-item img {\n max-height: 3.3em;\n}\n\n.musician-card {\n width: 30%;\n float: left;\n margin-right: 1em;\n}\n\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n"]} -------------------------------------------------------------------------------- /public/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Welcome to your Workbox-powered service worker! 3 | * 4 | * You'll need to register this file in your web app and you should 5 | * disable HTTP caching for this file too. 6 | * See https://goo.gl/nhQhGp 7 | * 8 | * The rest of the code is auto-generated. Please don't update this file 9 | * directly; instead, make changes to your Workbox build configuration 10 | * and re-run your build process. 11 | * See https://goo.gl/2aRDsh 12 | */ 13 | 14 | importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.0/workbox-sw.js"); 15 | 16 | importScripts( 17 | "/precache-manifest.01c35f111889c6ee36dd438e939568a2.js" 18 | ); 19 | 20 | self.addEventListener('message', (event) => { 21 | if (event.data && event.data.type === 'SKIP_WAITING') { 22 | self.skipWaiting(); 23 | } 24 | }); 25 | 26 | workbox.core.clientsClaim(); 27 | 28 | /** 29 | * The workboxSW.precacheAndRoute() method efficiently caches and responds to 30 | * requests for URLs in the manifest. 31 | * See https://goo.gl/S9QRab 32 | */ 33 | self.__precacheManifest = [].concat(self.__precacheManifest || []); 34 | workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); 35 | 36 | workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), { 37 | 38 | blacklist: [/^\/_/,/\/[^\/]+\.[^\/]+$/], 39 | }); 40 | -------------------------------------------------------------------------------- /public/static/js/runtime~main.a8a9905a.js: -------------------------------------------------------------------------------- 1 | !function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],c=0,s=[];c 10 |
11 | {props.formerrors.passwordmatch 12 | ? "Password value does not match confirm password value" 13 | : ""} 14 |
15 |
16 | {props.formerrors.blankfield ? "All fields are required" : ""} 17 |
18 | 19 | ); 20 | } else if (props.searchvalidationerror) { 21 | return ( 22 |
23 |
Enter a valid location
24 |
25 | ); 26 | } else if (props.apierrors) { 27 | return ( 28 |
29 |
{props.apierrors}
30 |
31 | ); 32 | } else if (props.formerrors && props.formerrors.cognito) { 33 | return ( 34 |
35 |
36 | {props.formerrors.cognito.message} 37 |
38 |
39 | ); 40 | } else { 41 | return
; 42 | } 43 | } 44 | 45 | export default FormErrors; -------------------------------------------------------------------------------- /client/src/components/Musicians.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import Musician from './Musician'; 3 | import axios from "axios"; 4 | const config = require('../config.json'); 5 | 6 | export default class Musicians extends Component { 7 | 8 | state = { 9 | newmusician: null, 10 | musicians: [] 11 | } 12 | 13 | fetchMusicians = () => { 14 | // add call to AWS API Gateway to fetch musicians here 15 | // then set them in state 16 | } 17 | 18 | componentDidMount = () => { 19 | this.fetchMusicians(); 20 | } 21 | 22 | render() { 23 | return ( 24 | 25 |
26 |
27 |

Energy Musicians

28 |

Invest in a clean future with our efficient and cost-effective green energy musicians:

29 |
30 |
31 |
32 |
33 | { 34 | this.state.musicians && this.state.musicians.length > 0 35 | ? this.state.musicians.map(musician => ) 36 | :
No musicians available
37 | } 38 |
39 |
40 |
41 |
42 |
43 |
44 | ) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /models/musician.js: -------------------------------------------------------------------------------- 1 | // model object with methods for store CRUD operations 2 | class Musician { 3 | 4 | constructor(store) { 5 | this.store = store; 6 | } 7 | 8 | // hydrate store with initial data 9 | initStore(data) { 10 | const newStore = Object.assign(this.store, data); 11 | this.store = newStore; 12 | }; 13 | 14 | // utility functions 15 | getStore() { 16 | return this.store; 17 | } 18 | 19 | printStore() { 20 | console.log(this.store); 21 | }; 22 | 23 | isMusicianInStore(id) { 24 | const keys = Object.keys(this.store); 25 | return keys.includes(id); 26 | } 27 | 28 | // get list of musicians from storage 29 | getMusicians(id, callback) { 30 | return callback(null, this.store); 31 | } 32 | 33 | // get musician from storage 34 | getMusician(id, callback) { 35 | if(this.isMusicianInStore(id)) { 36 | return callback(null, this.store[id]); 37 | } 38 | return callback('Musician does not exist'); 39 | } 40 | 41 | // modify existing musician or add a new one to storage 42 | putMusician(id, musician, callback) { 43 | if (id !== musician.firstName.toLowerCase()) { 44 | return callback("Musician id in request path and body do not match."); 45 | } 46 | const newStore = Object.assign({}, this.store); 47 | if(this.isMusicianInStore(id)) { 48 | const newMusician = Object.assign(this.store[id], musician); 49 | newStore[id] = newMusician; 50 | }else { 51 | newStore[id] = musician; 52 | } 53 | this.store = newStore; 54 | return callback(null, id); 55 | } 56 | 57 | deleteMusician(id, callback) { 58 | const newStore = Object.assign({}, this.store); 59 | delete newStore[id]; 60 | this.store = newStore; 61 | return callback(null, id); 62 | } 63 | 64 | } 65 | 66 | module.exports = Musician; -------------------------------------------------------------------------------- /client/src/components/Musician.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | 3 | export default class MusicianAdmin extends Component { 4 | 5 | state = { 6 | isEditMode: false, 7 | updatedmusicianname: this.props.name 8 | } 9 | 10 | handleMusicianEdit = event => { 11 | event.preventDefault(); 12 | this.setState({ isEditMode: true }); 13 | } 14 | 15 | handleEditSave = event => { 16 | event.preventDefault(); 17 | this.setState({ isEditMode: false }); 18 | this.props.handleUpdateMusician(this.props.id, this.state.updatedmusicianname); 19 | } 20 | 21 | onAddMusicianNameChange = event => this.setState({ "updatedmusicianname": event.target.value }); 22 | 23 | render() { 24 | return ( 25 |
26 | { 27 | this.props.isAdmin && 28 | 29 | 30 | 31 | } 32 | { 33 | this.state.isEditMode 34 | ?
35 |

Edit musician name

36 | 43 |

id: { this.props.id }

44 | 48 |
49 | :
50 |

{this.props.firstname } {this.props.lastname }

51 |

genre: { this.props.genre }

52 |
53 | } 54 |
55 | ) 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | Musician App
-------------------------------------------------------------------------------- /routes/musician.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const bodyParser = require('body-parser'); 4 | const jsonParser = bodyParser.json(); 5 | const schema = require('../store/schema'); 6 | 7 | // healthcheck 8 | router.get('/health', (req, res) => { 9 | res.status('200').send("Status: ok!"); 10 | }); 11 | 12 | // retrieve all musicians from data store 13 | router.get('/all', (req, res) => { 14 | const { musician } = req.app.locals; 15 | musician.getMusicians(req.params.id, (err, returnedMusicians) => { 16 | if (err) { 17 | res.status('400').send({errorMessage: err}); 18 | } 19 | res.status('200').send(returnedMusicians); 20 | }); 21 | }); 22 | 23 | // retrieve a musician from data store 24 | router.get('/:id', (req, res) => { 25 | const { musician } = req.app.locals; 26 | musician.getMusician(req.params.id, (err, returnedMusician) => { 27 | if (err) { 28 | res.status('400').send({errorMessage: err}); 29 | } 30 | res.status('200').send(returnedMusician); 31 | }); 32 | }); 33 | 34 | // modify existing musician or add a new one to the data store 35 | router.put('/:id', jsonParser, async (req, res) => { 36 | try { 37 | const valid = await schema.isValid(req.body); 38 | if(valid) { 39 | const { musician } = req.app.locals; 40 | musician.putMusician(req.params.id, req.body, (err, id) => { 41 | if (err) { 42 | res.status('400').send({errorMessage: err}); 43 | } 44 | res.status('200').send({id: id}); 45 | }); 46 | } else { 47 | res.status('400').send({errorMessage: 'Invalid request body'}); 48 | } 49 | } catch(err) { 50 | res.status('400').send({errorMessage: 'Invalid request body'}); 51 | } 52 | }); 53 | 54 | // retrieve a musician from data store 55 | router.delete('/:id', (req, res) => { 56 | const { musician } = req.app.locals; 57 | musician.deleteMusician(req.params.id, (err, deletedMusicianId) => { 58 | if (err) { 59 | res.status('400').send({errorMessage: err}); 60 | } 61 | res.status('200').send(deletedMusicianId); 62 | }); 63 | }); 64 | 65 | module.exports = router; -------------------------------------------------------------------------------- /models/musician.test.js: -------------------------------------------------------------------------------- 1 | const store = require('../store/datastore'); 2 | const initialStoreData = require('../store/data'); 3 | const Musician = require('./musician'); 4 | 5 | beforeAll(done => { 6 | // initialize store 7 | musician = new Musician(store); 8 | musician.initStore(initialStoreData); 9 | done(); 10 | }); 11 | 12 | describe('Test suite for Musician model', () => { 13 | 14 | test('Verify that store is initialized', () => { 15 | expect(musician).not.toBeNull(); 16 | expect(musician).toBeInstanceOf(Musician); 17 | }); 18 | 19 | test('Vertfy model get success case', () => { 20 | musician.getMusician('ella', (err, musician) => { 21 | expect(err).toBeNull(); 22 | expect(musician).not.toBeNull(); 23 | expect(musician).toHaveProperty('firstName'); 24 | expect(musician).toHaveProperty('lastName'); 25 | expect(musician).toHaveProperty('genre'); 26 | }); 27 | }); 28 | 29 | test('Vertfy model get error case - musician does not exist', () => { 30 | musician.getMusician('xxx', (err, musician) => { 31 | expect(err).not.toBeNull(); 32 | expect(err).toBe('Musician does not exist'); 33 | expect(musician).toBeUndefined(); 34 | }); 35 | }); 36 | 37 | test('Vertfy model put success case - NEW', () => { 38 | const newMusician = { 39 | firstName: "Ash", 40 | lastName: "Bowie", 41 | genre: "ROCK" 42 | }; 43 | musician.putMusician("ash", newMusician, (err, id) => { 44 | expect(err).toBeNull(); 45 | expect(id).not.toBeNull(); 46 | }); 47 | }); 48 | 49 | test('Vertfy model put success case - EXISTING', () => { 50 | const existingMusician = { 51 | firstName: 'Paul', 52 | lastName: 'McCartney', 53 | genre: 'POP' 54 | }; 55 | musician.putMusician("paul", existingMusician, (err, id) => { 56 | expect(err).toBeNull(); 57 | expect(id).not.toBeNull(); 58 | }); 59 | }); 60 | 61 | test('Vertfy model put error case - EXISTING', () => { 62 | const existingMusician = { 63 | firstName: 'Sir Paul', 64 | lastName: 'McCartney', 65 | genre: 'ROCK' 66 | }; 67 | musician.putMusician("paul", existingMusician, (err, id) => { 68 | expect(err).not.toBeNull(); 69 | expect(err).toBe("Musician id in request path and body do not match."); 70 | expect(id).toBeUndefined(); 71 | }); 72 | }); 73 | 74 | test('Vertfy model put error case', () => { 75 | const newMusician = { 76 | firstName: "Ashley", 77 | lastName: "Bowie", 78 | genre: "ROCK" 79 | }; 80 | musician.putMusician("ash", newMusician, (err, id) => { 81 | expect(err).not.toBeNull(); 82 | expect(err).toBe("Musician id in request path and body do not match."); 83 | expect(id).toBeUndefined(); 84 | }); 85 | }); 86 | 87 | }); 88 | 89 | -------------------------------------------------------------------------------- /client/src/components/HomeContent.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | export default function HomeContent() { 4 | return ( 5 |
6 |
7 |
8 |
9 |
10 | 11 |
12 |
13 |
14 |

Jazz

15 |

Purus semper eget duis at tellus at urna condimentum mattis. Non blandit massa enim nec. Integer enim neque volutpat ac tincidunt vitae semper quis. Accumsan tortor posuere ac ut consequat semper viverra nam.

16 |

Learn more

17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 |
28 |

Rock

29 |

Ut venenatis tellus in metus vulputate. Amet consectetur adipiscing elit pellentesque. Sed arcu non odio euismod lacinia at quis risus. Faucibus turpis in eu mi bibendum neque egestas cmonsu songue. Phasellus vestibulum lorem 30 | sed risus.

31 |

Learn more

32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | 40 |
41 |
42 |
43 |

Blues

44 |

Imperdiet dui accumsan sit amet nulla facilisi morbi. Fusce ut placerat orci nulla pellentesque dignissim enim. Libero id faucibus nisl tincidunt eget nullam. Commodo viverra maecenas accumsan lacus vel facilisis.

45 |

Learn more

46 |
47 |
48 |
49 |
50 |
51 |
52 | ) 53 | } 54 | -------------------------------------------------------------------------------- /client/src/components/utility/FormValidation.js: -------------------------------------------------------------------------------- 1 | function validateForm(event, state) { 2 | // clear all error messages 3 | const inputs = document.getElementsByClassName("is-danger"); 4 | for (let i = 0; i < inputs.length; i++) { 5 | if (!inputs[i].classList.contains("error")) { 6 | inputs[i].classList.remove("is-danger"); 7 | } 8 | } 9 | 10 | if (state.hasOwnProperty("username") && state.username === "") { 11 | document.getElementById("username").classList.add("is-danger"); 12 | return { blankfield: true }; 13 | } 14 | if (state.hasOwnProperty("firstname") && state.firstname === "") { 15 | document.getElementById("firstname").classList.add("is-danger"); 16 | return { blankfield: true }; 17 | } 18 | if (state.hasOwnProperty("lastname") && state.lastname === "") { 19 | document.getElementById("lastname").classList.add("is-danger"); 20 | return { blankfield: true }; 21 | } 22 | if (state.hasOwnProperty("email") && state.email === "") { 23 | document.getElementById("email").classList.add("is-danger"); 24 | return { blankfield: true }; 25 | } 26 | if ( 27 | state.hasOwnProperty("verificationcode") && 28 | state.verificationcode === "" 29 | ) { 30 | document.getElementById("verificationcode").classList.add("is-danger"); 31 | return { blankfield: true }; 32 | } 33 | if (state.hasOwnProperty("password") && state.password === "") { 34 | document.getElementById("password").classList.add("is-danger"); 35 | return { blankfield: true }; 36 | } 37 | if (state.hasOwnProperty("oldpassword") && state.oldpassword === "") { 38 | document.getElementById("oldpassword").classList.add("is-danger"); 39 | return { blankfield: true }; 40 | } 41 | if (state.hasOwnProperty("newpassword") && state.newpassword === "") { 42 | document.getElementById("newpassword").classList.add("is-danger"); 43 | return { blankfield: true }; 44 | } 45 | if (state.hasOwnProperty("confirmpassword") && state.confirmpassword === "") { 46 | document.getElementById("confirmpassword").classList.add("is-danger"); 47 | return { blankfield: true }; 48 | } 49 | if ( 50 | state.hasOwnProperty("password") && 51 | state.hasOwnProperty("confirmpassword") && 52 | state.password !== state.confirmpassword 53 | ) { 54 | document.getElementById("password").classList.add("is-danger"); 55 | document.getElementById("confirmpassword").classList.add("is-danger"); 56 | return { passwordmatch: true }; 57 | } 58 | if ( 59 | state.hasOwnProperty("newpassword") && 60 | state.hasOwnProperty("confirmpassword") && 61 | state.newpassword !== state.confirmpassword 62 | ) { 63 | document.getElementById("newpassword").classList.add("is-danger"); 64 | document.getElementById("confirmpassword").classList.add("is-danger"); 65 | return { passwordmatch: true }; 66 | } 67 | return; 68 | } 69 | 70 | export default validateForm; -------------------------------------------------------------------------------- /routes/musician.test.js: -------------------------------------------------------------------------------- 1 | const request = require('supertest'); 2 | const store = require('../store/datastore'); 3 | const initialStoreData = require('../store/data'); 4 | const musicianRoutes = require('./musician'); 5 | const Musician = require('../models/musician'); 6 | 7 | beforeAll(done => { 8 | // initialize store 9 | musician = new Musician(store); 10 | musician.initStore(initialStoreData); 11 | done(); 12 | }); 13 | 14 | beforeEach(() => { 15 | server = require('../app'); 16 | }); 17 | 18 | afterEach(() => { 19 | server.close(); 20 | }); 21 | 22 | describe('Test suite for Musician store REST API', () => { 23 | 24 | test('Verify that store is initialized', () => { 25 | expect(musician).not.toBeNull(); 26 | expect(musician).toBeInstanceOf(Musician); 27 | }); 28 | 29 | test('It should fetch a musician via the GET method - success case', async () => { 30 | const res = await request(server).get('/musician/cobain'); 31 | const responseBody = JSON.parse(res.text); 32 | expect(res.status).toEqual(200); 33 | expect(responseBody).not.toBeNull(); 34 | expect(responseBody).toHaveProperty('firstName'); 35 | expect(responseBody).toHaveProperty('lastName'); 36 | expect(responseBody).toHaveProperty('genre'); 37 | }); 38 | 39 | test('It should fetch a musician via the GET method - error case', async () => { 40 | try { 41 | const res = await request(server).get('/musician/xxx'); 42 | }catch(err) { 43 | expect(err).not.toBeNull(); 44 | expect(err.toString()).toEqual('Error: Bad Request'); 45 | } 46 | }); 47 | 48 | test('It should add a new musician via the PUT method - success case', async () => { 49 | const newMusician = { 50 | firstName: "Bo", 51 | lastName: "Hansson", 52 | genre: "ROCK" 53 | }; 54 | const res = await request(server).put('/musician/bo').send(newMusician); 55 | const responseBody = JSON.parse(res.text); 56 | expect(res.status).toEqual(200); 57 | expect(responseBody).not.toBeNull(); 58 | expect(responseBody).toHaveProperty('id'); 59 | expect(responseBody.id).toEqual('bo'); 60 | }); 61 | 62 | test('It should modify an existing musician via the PUT method - success case', async () => { 63 | const musician = { 64 | firstName: "BB", 65 | lastName: "King", 66 | genre: "ROCK" 67 | }; 68 | const res = await request(server).put('/musician/king').send(musician); 69 | const responseBody = JSON.parse(res.text); 70 | expect(res.status).toEqual(200); 71 | expect(responseBody).not.toBeNull(); 72 | expect(responseBody).toHaveProperty('id'); 73 | expect(responseBody.id).toEqual('king'); 74 | }); 75 | 76 | test('It should add a new musician via the PUT method - error case (fails body validation)', async () => { 77 | const newMusician = { 78 | firstName: [], 79 | lastName: "Hansson", 80 | genre: "ROCK" 81 | }; 82 | try { 83 | const res = await request(server).put('/musician/bo').send(newMusician); 84 | }catch(err) { 85 | expect(err).not.toBeNull(); 86 | } 87 | }); 88 | 89 | }); 90 | 91 | -------------------------------------------------------------------------------- /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 | ### `npm 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 | ### `npm 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 | ### `npm run 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 | ### `npm run 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 | ### `npm run 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/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.1/8 is 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 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /client/src/components/MusiciansAdmin.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import Musician from './Musician'; 3 | import axios from "axios"; 4 | 5 | export default class MusiciansAdmin extends Component { 6 | 7 | state = { 8 | newmusician: { 9 | firstName: "", 10 | lastName: "", 11 | genre: "" 12 | }, 13 | musicians: [] 14 | } 15 | 16 | outputHTML = ""; 17 | 18 | handleAddMusician = async(id, event) => { 19 | event.preventDefault(); 20 | try { 21 | await axios.put(`/musician/${id}`, this.state.newmusician); 22 | this.setState({ musicians: [...this.state.musicians, this.state.newmusician] }); 23 | this.setState({ newmusician: { "firstName": "", "lastName": "", "genre": "" }}); 24 | }catch(err) { 25 | console.log(err); 26 | } 27 | } 28 | 29 | handleUpdateMusician = (id, name) => { 30 | // add call to AWS API Gateway update musician endpoint here 31 | const musicianToUpdate = [...this.state.musicians].find(musician => musician.id === id); 32 | const updatedMusicians = [...this.state.musicians].filter(musician => musician.id !== id); 33 | musicianToUpdate.musicianname = name; 34 | updatedMusicians.push(musicianToUpdate); 35 | this.setState({musicians: updatedMusicians}); 36 | } 37 | 38 | handleDeleteMusician = async(id, event) => { 39 | // using firstName as the id in musicians state 40 | event.preventDefault(); 41 | try { 42 | await axios.delete(`/musician/${id}`); 43 | const updatedMusicians = await [...this.state.musicians].filter(musician => musician.firstName.toLowerCase() !== id); 44 | this.setState({musicians: updatedMusicians}); 45 | }catch(err) { 46 | console.log(err); 47 | } 48 | } 49 | 50 | fetchMusicians = async() => { 51 | try{ 52 | const res = await axios.get('/musician/all'); 53 | const allMusicians = Object.keys(res.data).map((key) => { 54 | return res.data[key]; 55 | }); 56 | this.setState({ musicians: [...allMusicians] }); 57 | }catch(err) { 58 | console.log(err); 59 | } 60 | } 61 | 62 | onAddMusicianFirstNameChange = event => this.setState({ newmusician: { ...this.state.newmusician, "firstName": event.target.value } }); 63 | onAddMusicianLastNameChange = event => this.setState({ newmusician: { ...this.state.newmusician, "lastName": event.target.value } }); 64 | onAddMusicianGenreChange = event => this.setState({ newmusician: { ...this.state.newmusician, "genre": event.target.value } }); 65 | 66 | componentDidMount = () => { 67 | this.fetchMusicians(); 68 | } 69 | 70 | render() { 71 | return ( 72 | 73 |
74 |
75 |

Add and remove musicians using the form below:

76 |
77 |
78 |
79 |
this.handleAddMusician(this.state.newmusician.firstName.toLowerCase(), event)}> 80 |
81 |
82 | 89 |
90 |
91 |
92 |
93 | 100 |
101 |
102 |
103 |
104 | 111 |
112 |
113 |
114 |
115 | 118 |
119 |
120 |
121 |
122 |
123 | { 124 | this.state.musicians.map((musician, index) => 125 | 136 | )} 137 |
138 |
139 |
140 |
141 |
142 | ) 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /public/static/js/runtime~main.a8a9905a.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice"],"mappings":"aACA,SAAAA,EAAAC,GAQA,IAPA,IAMAC,EAAAC,EANAC,EAAAH,EAAA,GACAI,EAAAJ,EAAA,GACAK,EAAAL,EAAA,GAIAM,EAAA,EAAAC,EAAA,GACQD,EAAAH,EAAAK,OAAoBF,IAC5BJ,EAAAC,EAAAG,GACAG,EAAAP,IACAK,EAAAG,KAAAD,EAAAP,GAAA,IAEAO,EAAAP,GAAA,EAEA,IAAAD,KAAAG,EACAO,OAAAC,UAAAC,eAAAC,KAAAV,EAAAH,KACAc,EAAAd,GAAAG,EAAAH,IAKA,IAFAe,KAAAhB,GAEAO,EAAAC,QACAD,EAAAU,OAAAV,GAOA,OAHAW,EAAAR,KAAAS,MAAAD,EAAAb,GAAA,IAGAe,IAEA,SAAAA,IAEA,IADA,IAAAC,EACAf,EAAA,EAAiBA,EAAAY,EAAAV,OAA4BF,IAAA,CAG7C,IAFA,IAAAgB,EAAAJ,EAAAZ,GACAiB,GAAA,EACAC,EAAA,EAAkBA,EAAAF,EAAAd,OAA2BgB,IAAA,CAC7C,IAAAC,EAAAH,EAAAE,GACA,IAAAf,EAAAgB,KAAAF,GAAA,GAEAA,IACAL,EAAAQ,OAAApB,IAAA,GACAe,EAAAM,IAAAC,EAAAN,EAAA,KAGA,OAAAD,EAIA,IAAAQ,EAAA,GAKApB,EAAA,CACAqB,EAAA,GAGAZ,EAAA,GAGA,SAAAS,EAAA1B,GAGA,GAAA4B,EAAA5B,GACA,OAAA4B,EAAA5B,GAAA8B,QAGA,IAAAC,EAAAH,EAAA5B,GAAA,CACAK,EAAAL,EACAgC,GAAA,EACAF,QAAA,IAUA,OANAhB,EAAAd,GAAAa,KAAAkB,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAnB,EAGAY,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACA1B,OAAA6B,eAAAT,EAAAM,EAAA,CAA0CI,YAAA,EAAAC,IAAAJ,KAK1CX,EAAAgB,EAAA,SAAAZ,GACA,qBAAAa,eAAAC,aACAlC,OAAA6B,eAAAT,EAAAa,OAAAC,YAAA,CAAwDC,MAAA,WAExDnC,OAAA6B,eAAAT,EAAA,cAAiDe,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,kBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAvC,OAAAwC,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAvC,OAAA6B,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAAnB,EAAAS,EAAAc,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAvB,EAAA2B,EAAA,SAAAtB,GACA,IAAAM,EAAAN,KAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAgB,EAAAC,GAAsD,OAAA7C,OAAAC,UAAAC,eAAAC,KAAAyC,EAAAC,IAGtD7B,EAAA8B,EAAA,IAEA,IAAAC,EAAAC,OAAA,aAAAA,OAAA,iBACAC,EAAAF,EAAAhD,KAAA2C,KAAAK,GACAA,EAAAhD,KAAAX,EACA2D,IAAAG,QACA,QAAAvD,EAAA,EAAgBA,EAAAoD,EAAAlD,OAAuBF,IAAAP,EAAA2D,EAAApD,IACvC,IAAAU,EAAA4C,EAIAxC","file":"static/js/runtime~main.a8a9905a.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /public/static/js/main.7aabff24.chunk.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{29:function(e,a,t){e.exports=t(61)},35:function(e,a,t){},36:function(e,a,t){},61:function(e,a,t){"use strict";t.r(a);var n=t(0),i=t.n(n),s=t(25),c=t.n(s),r=(t(34),t(35),t(4)),l=t(5),u=t(7),m=t(6),o=t(8),d=t(64),p=t(66),h=t(65),v=(t(36),function(e){function a(){return Object(r.a)(this,a),Object(u.a)(this,Object(m.a)(a).apply(this,arguments))}return Object(o.a)(a,e),Object(l.a)(a,[{key:"render",value:function(){return i.a.createElement("nav",{className:"navbar",role:"navigation","aria-label":"main navigation"},i.a.createElement("div",{className:"navbar-brand"},i.a.createElement("a",{className:"navbar-item",href:"/"},i.a.createElement("img",{src:"notes-logo.jpg",width:"400",height:"50",alt:"logo"}))),i.a.createElement("div",{id:"navbarBasicExample",className:"navbar-menu"},i.a.createElement("div",{className:"navbar-start"}),i.a.createElement("div",{className:"navbar-end"},i.a.createElement("div",{className:"navbar-item"},i.a.createElement("div",{className:"buttons"},i.a.createElement("a",{href:"/register",className:"button is-primary"},i.a.createElement("strong",null,"Sign up")),i.a.createElement("a",{href:"/login",className:"button is-light"},"Log in"))))))}}]),a}(n.Component));function f(){return i.a.createElement("section",{className:"hero is-primary"},i.a.createElement("div",{className:"hero-body"},i.a.createElement("div",{className:"container"},"Musician App")))}var E=t(16),b=t(9),N=t.n(b),g=t(11),w=t(14),j=function(e){function a(){var e,t;Object(r.a)(this,a);for(var n=arguments.length,i=new Array(n),s=0;s\r\n
\r\n \r\n \"logo\"\r\n \r\n
\r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n )\r\n }\r\n}\r\n","import React from 'react';\r\n\r\nexport default function Hero() {\r\n return (\r\n
\r\n
\r\n
\r\n Musician App\r\n
\r\n
\r\n
\r\n )\r\n}\r\n","import React, { Component, Fragment } from 'react';\r\n\r\nexport default class MusicianAdmin extends Component {\r\n\r\n state = {\r\n isEditMode: false,\r\n updatedmusicianname: this.props.name\r\n }\r\n\r\n handleMusicianEdit = event => {\r\n event.preventDefault();\r\n this.setState({ isEditMode: true });\r\n }\r\n\r\n handleEditSave = event => {\r\n event.preventDefault();\r\n this.setState({ isEditMode: false });\r\n this.props.handleUpdateMusician(this.props.id, this.state.updatedmusicianname);\r\n }\r\n\r\n onAddMusicianNameChange = event => this.setState({ \"updatedmusicianname\": event.target.value });\r\n\r\n render() {\r\n return (\r\n
\r\n {\r\n this.props.isAdmin && \r\n \r\n \r\n \r\n }\r\n {\r\n this.state.isEditMode \r\n ?
\r\n

Edit musician name

\r\n \r\n

id: { this.props.id }

\r\n \r\n
\r\n :
\r\n

{this.props.firstname } {this.props.lastname }

\r\n

genre: { this.props.genre }

\r\n
\r\n }\r\n
\r\n )\r\n }\r\n}\r\n","import React, { Component, Fragment } from 'react';\r\nimport Musician from './Musician';\r\nimport axios from \"axios\";\r\n\r\nexport default class MusiciansAdmin extends Component {\r\n\r\n state = {\r\n newmusician: { \r\n firstName: \"\",\r\n lastName: \"\",\r\n genre: \"\"\r\n },\r\n musicians: []\r\n }\r\n\r\n outputHTML = \"\";\r\n\r\n handleAddMusician = async(id, event) => {\r\n event.preventDefault();\r\n try {\r\n await axios.put(`/musician/${id}`, this.state.newmusician);\r\n this.setState({ musicians: [...this.state.musicians, this.state.newmusician] });\r\n this.setState({ newmusician: { \"firstName\": \"\", \"lastName\": \"\", \"genre\": \"\" }});\r\n }catch(err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n handleUpdateMusician = (id, name) => {\r\n // add call to AWS API Gateway update musician endpoint here\r\n const musicianToUpdate = [...this.state.musicians].find(musician => musician.id === id);\r\n const updatedMusicians = [...this.state.musicians].filter(musician => musician.id !== id);\r\n musicianToUpdate.musicianname = name;\r\n updatedMusicians.push(musicianToUpdate);\r\n this.setState({musicians: updatedMusicians});\r\n }\r\n\r\n handleDeleteMusician = async(id, event) => {\r\n // using firstName as the id in musicians state\r\n event.preventDefault();\r\n try {\r\n await axios.delete(`/musician/${id}`);\r\n const updatedMusicians = await [...this.state.musicians].filter(musician => musician.firstName.toLowerCase() !== id);\r\n this.setState({musicians: updatedMusicians});\r\n }catch(err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n fetchMusicians = async() => {\r\n try{\r\n const res = await axios.get('/musician/all');\r\n const allMusicians = Object.keys(res.data).map((key) => {\r\n return res.data[key];\r\n });\r\n this.setState({ musicians: [...allMusicians] });\r\n }catch(err) {\r\n console.log(err);\r\n }\r\n }\r\n\r\n onAddMusicianFirstNameChange = event => this.setState({ newmusician: { ...this.state.newmusician, \"firstName\": event.target.value } });\r\n onAddMusicianLastNameChange = event => this.setState({ newmusician: { ...this.state.newmusician, \"lastName\": event.target.value } });\r\n onAddMusicianGenreChange = event => this.setState({ newmusician: { ...this.state.newmusician, \"genre\": event.target.value } });\r\n\r\n componentDidMount = () => {\r\n this.fetchMusicians();\r\n }\r\n\r\n render() {\r\n return (\r\n \r\n
\r\n
\r\n

Add and remove musicians using the form below:

\r\n
\r\n
\r\n
\r\n
this.handleAddMusician(this.state.newmusician.firstName.toLowerCase(), event)}>\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n {\r\n this.state.musicians.map((musician, index) =>\r\n \r\n )}\r\n
\r\n
\r\n
\r\n
\r\n
\r\n )\r\n }\r\n}\r\n","import React, { Fragment } from 'react';\r\nimport Hero from './Hero';\r\nimport MusiciansAdmin from './MusiciansAdmin';\r\n\r\nexport default function Home() {\r\n return (\r\n \r\n \r\n \r\n \r\n )\r\n}\r\n","import React from 'react'\r\n\r\nexport default function Footer() {\r\n return (\r\n
\r\n
\r\n

\r\n Musician App 2019. The source code is licensed MIT. The website content is licensed CC BY NC SA 4.0.\r\n

\r\n
\r\n
\r\n )\r\n}\r\n","import React, { Component } from 'react';\nimport { BrowserRouter as Router, Route, Switch } from 'react-router-dom';\nimport './App.css';\nimport Navbar from './components/Navbar';\nimport Home from './components/Home';\nimport Footer from './components/Footer';\nimport { library } from '@fortawesome/fontawesome-svg-core';\nimport { faEdit } from '@fortawesome/free-solid-svg-icons'\nlibrary.add(faEdit);\n\nclass App extends Component {\n render() {\n return (\n
\n \n
\n \n \n \n \n
\n
\n
\n
\n );\n }\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport 'bulma/css/bulma.min.css';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""} --------------------------------------------------------------------------------