getCars() {
17 | return repository.findAll();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Chapter05/src/main/java/com/packt/cardatabase/web/LoginController.java:
--------------------------------------------------------------------------------
1 | package com.packt.cardatabase.web;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.http.HttpHeaders;
5 | import org.springframework.http.MediaType;
6 | import org.springframework.http.ResponseEntity;
7 | import org.springframework.security.authentication.AuthenticationManager;
8 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
9 | import org.springframework.security.core.Authentication;
10 | import org.springframework.web.bind.annotation.RequestBody;
11 | import org.springframework.web.bind.annotation.RequestMapping;
12 | import org.springframework.web.bind.annotation.RequestMethod;
13 | import org.springframework.web.bind.annotation.RestController;
14 |
15 | import com.packt.cardatabase.domain.AccountCredentials;
16 | import com.packt.cardatabase.service.JwtService;
17 |
18 | @RestController
19 | public class LoginController {
20 | @Autowired
21 | private JwtService jwtService;
22 |
23 | @Autowired
24 | AuthenticationManager authenticationManager;
25 |
26 | @RequestMapping(value="/login", method=RequestMethod.POST)
27 | public ResponseEntity> getToken(@RequestBody AccountCredentials credentials) {
28 | UsernamePasswordAuthenticationToken creds =
29 | new UsernamePasswordAuthenticationToken(
30 | credentials.getUsername(),
31 | credentials.getPassword());
32 |
33 | Authentication auth = authenticationManager.authenticate(creds);
34 |
35 | // Generate token
36 | String jwts = jwtService.getToken(auth.getName());
37 |
38 | // Build response with the generated token
39 | return ResponseEntity.ok()
40 | .header(HttpHeaders.AUTHORIZATION, "Bearer " + jwts)
41 | .header(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Authorization")
42 | .build();
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Chapter05/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mariadb://localhost:3306/cardb
2 | spring.datasource.username=root
3 | spring.datasource.password=root
4 | spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
5 | spring.jpa.generate-ddl=true
6 | spring.jpa.hibernate.ddl-auto=create-drop
7 |
8 | spring.jpa.show-sql=true
9 | spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false
10 | spring.data.rest.basePath=/api
--------------------------------------------------------------------------------
/Chapter05/src/test/java/com/packt/cardatabase/CarRestTest.java:
--------------------------------------------------------------------------------
1 | package com.packt.cardatabase;
2 |
3 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
4 | import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
5 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
6 |
7 | import org.junit.jupiter.api.Test;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
10 | import org.springframework.boot.test.context.SpringBootTest;
11 | import org.springframework.http.HttpHeaders;
12 | import org.springframework.test.web.servlet.MockMvc;
13 |
14 | @SpringBootTest
15 | @AutoConfigureMockMvc
16 | public class CarRestTest {
17 | @Autowired
18 | private MockMvc mockMvc;
19 |
20 | @Test
21 | public void testAuthentication() throws Exception {
22 | // Testing authentication with correct credentials
23 | this.mockMvc.perform(post("/login").content("{\"username\":\"admin\", \"password\":\"admin\"}").
24 | header(HttpHeaders.CONTENT_TYPE, "application/json")).
25 | andDo(print()).andExpect(status().isOk());
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Chapter05/src/test/java/com/packt/cardatabase/CardatabaseApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.packt.cardatabase;
2 |
3 | import static org.assertj.core.api.Assertions.assertThat;
4 |
5 | import org.junit.jupiter.api.Test;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.boot.test.context.SpringBootTest;
8 |
9 | import com.packt.cardatabase.web.CarController;
10 |
11 | @SpringBootTest
12 | class CardatabaseApplicationTests {
13 | @Autowired
14 | private CarController controller;
15 |
16 | @Test
17 | void contextLoads() {
18 | assertThat(controller).isNotNull();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Chapter05/src/test/java/com/packt/cardatabase/OwnerRepositoryTest.java:
--------------------------------------------------------------------------------
1 | package com.packt.cardatabase;
2 |
3 | import static org.assertj.core.api.Assertions.assertThat;
4 | import org.junit.jupiter.api.Test;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
7 |
8 | import com.packt.cardatabase.domain.Owner;
9 | import com.packt.cardatabase.domain.OwnerRepository;
10 |
11 | @DataJpaTest
12 | public class OwnerRepositoryTest {
13 | @Autowired
14 | private OwnerRepository repository;
15 |
16 | @Test
17 | void saveOwner() {
18 | repository.save(new Owner("Lucy", "Smith"));
19 | assertThat(repository.findByFirstname("Lucy").isPresent()).isTrue();
20 | }
21 |
22 | @Test
23 | void deleteOwners() {
24 | repository.save(new Owner("Lisa", "Morrison"));
25 | repository.deleteAll();
26 | assertThat(repository.count()).isEqualTo(0);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter06/Readme.md:
--------------------------------------------------------------------------------
1 | ## Commands used in chapter 6
2 |
3 | These commands prints out the version of npm and node
4 |
5 | ```
6 | npm -v
7 | node -v
8 | ```
9 |
10 | This command creates React app named myapp:
11 |
12 | ```
13 | npx create-react-app myapp
14 | ```
15 |
16 | This command starts React app (execute in the project root folder)
17 |
18 | ```
19 | npm start
20 | ```
21 |
22 | OR if you are using yarn
23 |
24 | ```
25 | yarn start
26 | ```
27 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/.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 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "myform",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.4",
7 | "@testing-library/react": "^13.1.1",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.0.0",
10 | "react-dom": "^18.0.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyForm/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter07/MyForm/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 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyForm/public/logo192.png
--------------------------------------------------------------------------------
/Chapter07/MyForm/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyForm/public/logo512.png
--------------------------------------------------------------------------------
/Chapter07/MyForm/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 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/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 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import MyForm from './MyForm';
3 |
4 | function App() {
5 | return (
6 |
7 | );
8 | }
9 |
10 | export default App;
11 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/src/MyForm.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 |
3 | function MyForm() {
4 | const [firstName, setFirstName] = useState('');
5 | const [lastName, setLastName] = useState('');
6 | const [email, setEmail] = useState('');
7 |
8 | const handleSubmit = (event) => {
9 | alert(`Hello ${firstName} ${lastName}`);
10 | event.preventDefault();
11 | }
12 |
13 | return (
14 |
29 | );
30 | }
31 |
32 | export default MyForm;
--------------------------------------------------------------------------------
/Chapter07/MyForm/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 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter07/MyForm/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';
6 |
--------------------------------------------------------------------------------
/Chapter07/MyList/.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 |
--------------------------------------------------------------------------------
/Chapter07/MyList/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mylist",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.4",
7 | "@testing-library/react": "^13.1.1",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.0.0",
10 | "react-dom": "^18.0.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter07/MyList/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyList/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter07/MyList/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 |
--------------------------------------------------------------------------------
/Chapter07/MyList/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyList/public/logo192.png
--------------------------------------------------------------------------------
/Chapter07/MyList/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyList/public/logo512.png
--------------------------------------------------------------------------------
/Chapter07/MyList/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 |
--------------------------------------------------------------------------------
/Chapter07/MyList/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter07/MyList/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 |
--------------------------------------------------------------------------------
/Chapter07/MyList/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import MyList from './MyList';
3 |
4 | function App() {
5 | return (
6 |
7 | );
8 | }
9 |
10 | export default App;
11 |
--------------------------------------------------------------------------------
/Chapter07/MyList/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter07/MyList/src/MyList.js:
--------------------------------------------------------------------------------
1 | function MyList() {
2 | const data = [1, 2, 3, 4, 5];
3 |
4 | return (
5 |
6 |
7 | {
8 | data.map((number, index) =>
9 | Listitem {number} )
10 | }
11 |
12 |
13 | );
14 | };
15 |
16 | export default MyList;
17 |
--------------------------------------------------------------------------------
/Chapter07/MyList/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 |
--------------------------------------------------------------------------------
/Chapter07/MyList/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/Chapter07/MyList/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter07/MyList/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter07/MyList/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';
6 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/.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 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mytable",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.4",
7 | "@testing-library/react": "^13.1.1",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.0.0",
10 | "react-dom": "^18.0.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyTable/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter07/MyTable/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 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyTable/public/logo192.png
--------------------------------------------------------------------------------
/Chapter07/MyTable/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter07/MyTable/public/logo512.png
--------------------------------------------------------------------------------
/Chapter07/MyTable/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 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/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 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/src/App.js:
--------------------------------------------------------------------------------
1 | import MyTable from './MyTable';
2 |
3 | function App() {
4 | return (
5 |
6 | );
7 | }
8 |
9 | export default App;
10 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/src/MyTable.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | function MyTable() {
4 | const data = [
5 | {brand: 'Ford', model: 'Mustang'},
6 | {brand: 'VW', model: 'Beetle'},
7 | {brand: 'Tesla', model: 'Model S'}];
8 |
9 | return (
10 |
11 |
12 |
13 | {
14 | data.map((item, index) =>
15 |
16 | {item.brand} {item.model}
17 | )
18 | }
19 |
20 |
21 |
22 | );
23 | };
24 |
25 | export default MyTable;
26 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/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 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter07/MyTable/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';
6 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/.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 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "restgithub",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.4",
7 | "@testing-library/react": "^13.1.1",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.0.0",
10 | "react-dom": "^18.0.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter08/restgithub/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter08/restgithub/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 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter08/restgithub/public/logo192.png
--------------------------------------------------------------------------------
/Chapter08/restgithub/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter08/restgithub/public/logo512.png
--------------------------------------------------------------------------------
/Chapter08/restgithub/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 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/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 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import './App.css';
3 |
4 | function App() {
5 | const [keyword, setKeyword] = useState('');
6 | const [data, setData] = useState([]);
7 |
8 | const fetchData = () => {
9 | fetch(`https://api.github.com/search/repositories?q=${keyword}`)
10 | .then(response => response.json())
11 | .then(data => setData(data.items))
12 | .catch(err => console.error(err))
13 | }
14 |
15 | return (
16 |
17 |
setKeyword(e.target.value)} />
19 |
Fetch
20 |
21 |
22 | {
23 | data.map(repo =>
24 |
25 | {repo.full_name}
26 |
27 | {repo.html_url}
28 |
29 |
30 | )
31 | }
32 |
33 |
34 |
35 | );
36 | }
37 |
38 | export default App;
39 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/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 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter08/restgithub/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';
6 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/.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 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "weatherapp",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.4",
7 | "@testing-library/react": "^13.1.1",
8 | "@testing-library/user-event": "^13.5.0",
9 | "react": "^18.0.0",
10 | "react-dom": "^18.0.0",
11 | "react-scripts": "5.0.1",
12 | "web-vitals": "^2.1.4"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject"
19 | },
20 | "eslintConfig": {
21 | "extends": [
22 | "react-app",
23 | "react-app/jest"
24 | ]
25 | },
26 | "browserslist": {
27 | "production": [
28 | ">0.2%",
29 | "not dead",
30 | "not op_mini all"
31 | ],
32 | "development": [
33 | "last 1 chrome version",
34 | "last 1 firefox version",
35 | "last 1 safari version"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter08/weatherapp/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter08/weatherapp/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 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter08/weatherapp/public/logo192.png
--------------------------------------------------------------------------------
/Chapter08/weatherapp/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter08/weatherapp/public/logo512.png
--------------------------------------------------------------------------------
/Chapter08/weatherapp/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 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/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 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import './App.css';
3 |
4 | function App() {
5 | const [temp, setTemp] = useState('');
6 | const [desc, setDesc] = useState('');
7 | const [icon, setIcon] = useState('');
8 | const [isReady, setReady] = useState(false);
9 |
10 | React.useEffect(() => {
11 | fetch(`http://api.openweathermap.org/data/2.5/weather?q=London&APPID=YOUR_API_KEY&units=metric`)
12 | .then(result => result.json())
13 | .then(jsonresult => {
14 | setTemp(jsonresult.main.temp);
15 | setDesc(jsonresult.weather[0].main);
16 | setIcon(jsonresult.weather[0].icon);
17 | setReady(true);
18 | })
19 | .catch(err => console.error(err))
20 | }, [])
21 |
22 | if (isReady) {
23 | return (
24 |
25 |
Temperature: {temp} °C
26 |
Description: {desc}
27 |
30 |
31 | );
32 | }
33 | else {
34 | return Loading...
35 | }
36 | }
37 | export default App;
38 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/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 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter08/weatherapp/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';
6 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/.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 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppinglist",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@emotion/react": "^11.8.2",
7 | "@emotion/styled": "^11.8.1",
8 | "@mui/material": "^5.6.0",
9 | "@testing-library/jest-dom": "^5.11.4",
10 | "@testing-library/react": "^11.1.0",
11 | "@testing-library/user-event": "^12.1.10",
12 | "react": "^18.0.0",
13 | "react-dom": "^18.0.0",
14 | "react-scripts": "4.0.3",
15 | "web-vitals": "^1.0.1"
16 | },
17 | "scripts": {
18 | "start": "react-scripts start",
19 | "build": "react-scripts build",
20 | "test": "react-scripts test",
21 | "eject": "react-scripts eject"
22 | },
23 | "eslintConfig": {
24 | "extends": [
25 | "react-app",
26 | "react-app/jest"
27 | ]
28 | },
29 | "browserslist": {
30 | "production": [
31 | ">0.2%",
32 | "not dead",
33 | "not op_mini all"
34 | ],
35 | "development": [
36 | "last 1 chrome version",
37 | "last 1 firefox version",
38 | "last 1 safari version"
39 | ]
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter09/shoppinglist/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/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 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter09/shoppinglist/public/logo192.png
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter09/shoppinglist/public/logo512.png
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/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 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/src/AddItem.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Button from '@mui/material/Button';
3 | import TextField from '@mui/material/TextField';
4 | import Dialog from '@mui/material/Dialog';
5 | import DialogActions from '@mui/material/DialogActions';
6 | import DialogContent from '@mui/material/DialogContent';
7 | import DialogTitle from '@mui/material/DialogTitle';
8 |
9 | function AddItem(props) {
10 | const [open, setOpen] = React.useState(false);
11 | const [item, setItem] = React.useState({
12 | product: '',
13 | amount:''
14 | });
15 |
16 | const handleOpen = () => {
17 | setOpen(true);
18 | }
19 |
20 | const handleClose = () => {
21 | setOpen(false);
22 | }
23 |
24 | const handleChange = (e) => {
25 | setItem({...item, [e.target.name]: e.target.value})
26 | }
27 |
28 | const addItem = () => {
29 | props.addItem(item);
30 | setItem({product: '', amount: ''});
31 | handleClose();
32 | }
33 |
34 | return(
35 |
36 |
37 | Add Item
38 |
39 |
40 | New Item
41 |
42 |
44 |
46 |
47 |
48 |
49 | Cancel
50 |
51 |
52 | Add
53 |
54 |
55 |
56 |
57 | );
58 | }
59 |
60 | export default AddItem;
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/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 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Container from '@mui/material/Container';
3 | import AppBar from '@mui/material/AppBar';
4 | import Toolbar from '@mui/material/Toolbar';
5 | import Typography from '@mui/material/Typography';
6 | import Stack from '@mui/material/Stack';
7 | import List from '@mui/material/List';
8 | import ListItem from '@mui/material/ListItem';
9 | import ListItemText from '@mui/material/ListItemText';
10 | import AddItem from './AddItem';
11 |
12 | function App() {
13 | const [items, setItems] = useState([]);
14 |
15 | const addItem = (item) => {
16 | setItems([item, ...items]);
17 | }
18 |
19 | return (
20 |
21 |
22 |
23 |
24 | Shopping List
25 |
26 |
27 |
28 |
29 |
30 |
31 | {
32 | items.map((item, index) =>
33 |
34 |
35 |
36 | )
37 | }
38 |
39 |
40 |
41 | );
42 | }
43 |
44 | export default App;
45 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/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 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import * as ReactDOMClient from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const container = document.getElementById('root');
8 |
9 | // Create a root.
10 | const root = ReactDOMClient.createRoot(container);
11 |
12 | root.render(
13 |
14 |
15 |
16 | );
17 |
18 | // If you want to start measuring performance in your app, pass a function
19 | // to log results (for example: reportWebVitals(console.log))
20 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
21 | reportWebVitals();
22 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter09/shoppinglist/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';
6 |
--------------------------------------------------------------------------------
/Chapter10/.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 |
--------------------------------------------------------------------------------
/Chapter10/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "carfront",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@emotion/react": "^11.9.0",
7 | "@emotion/styled": "^11.8.1",
8 | "@mui/material": "^5.6.2",
9 | "@testing-library/jest-dom": "^5.16.1",
10 | "@testing-library/react": "^13.1.1",
11 | "@testing-library/user-event": "^13.5.0",
12 | "react": "^18.0.0",
13 | "react-dom": "^18.0.0",
14 | "react-scripts": "^5.0.1",
15 | "web-vitals": "^2.1.4"
16 | },
17 | "scripts": {
18 | "start": "react-scripts start",
19 | "build": "react-scripts build",
20 | "test": "react-scripts test",
21 | "eject": "react-scripts eject"
22 | },
23 | "eslintConfig": {
24 | "extends": [
25 | "react-app",
26 | "react-app/jest"
27 | ]
28 | },
29 | "browserslist": {
30 | "production": [
31 | ">0.2%",
32 | "not dead",
33 | "not op_mini all"
34 | ],
35 | "development": [
36 | "last 1 chrome version",
37 | "last 1 firefox version",
38 | "last 1 safari version"
39 | ]
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Chapter10/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter10/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter10/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 |
--------------------------------------------------------------------------------
/Chapter10/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter10/public/logo192.png
--------------------------------------------------------------------------------
/Chapter10/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter10/public/logo512.png
--------------------------------------------------------------------------------
/Chapter10/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 |
--------------------------------------------------------------------------------
/Chapter10/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter10/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 |
--------------------------------------------------------------------------------
/Chapter10/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import AppBar from '@mui/material/AppBar';
3 | import Toolbar from '@mui/material/Toolbar';
4 | import Typography from '@mui/material/Typography';
5 |
6 | function App() {
7 | return (
8 |
9 |
10 |
11 |
12 | Carshop
13 |
14 |
15 |
16 |
17 | );
18 | }
19 |
20 | export default App;
21 |
--------------------------------------------------------------------------------
/Chapter10/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter10/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 |
--------------------------------------------------------------------------------
/Chapter10/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import * as ReactDOMClient from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const container = document.getElementById('root');
8 |
9 | // Create a root.
10 | const root = ReactDOMClient.createRoot(container);
11 |
12 | root.render(
13 |
14 |
15 |
16 | );
17 |
18 | // If you want to start measuring performance in your app, pass a function
19 | // to log results (for example: reportWebVitals(console.log))
20 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
21 | reportWebVitals();
22 |
--------------------------------------------------------------------------------
/Chapter10/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter10/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter10/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';
6 |
--------------------------------------------------------------------------------
/Chapter11/.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 |
--------------------------------------------------------------------------------
/Chapter11/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "carmuigrid",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@emotion/react": "^11.9.0",
7 | "@emotion/styled": "^11.8.1",
8 | "@mui/material": "^5.6.2",
9 | "@mui/x-data-grid": "^5.9.0",
10 | "@testing-library/jest-dom": "^5.16.1",
11 | "@testing-library/react": "^13.1.1",
12 | "@testing-library/user-event": "^13.5.0",
13 | "react": "^18.0.0",
14 | "react-dom": "^18.0.0",
15 | "react-scripts": "^5.0.1",
16 | "web-vitals": "^2.1.2"
17 | },
18 | "scripts": {
19 | "start": "react-scripts start",
20 | "build": "react-scripts build",
21 | "test": "react-scripts test",
22 | "eject": "react-scripts eject"
23 | },
24 | "eslintConfig": {
25 | "extends": [
26 | "react-app",
27 | "react-app/jest"
28 | ]
29 | },
30 | "browserslist": {
31 | "production": [
32 | ">0.2%",
33 | "not dead",
34 | "not op_mini all"
35 | ],
36 | "development": [
37 | "last 1 chrome version",
38 | "last 1 firefox version",
39 | "last 1 safari version"
40 | ]
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Chapter11/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter11/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter11/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 |
--------------------------------------------------------------------------------
/Chapter11/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter11/public/logo192.png
--------------------------------------------------------------------------------
/Chapter11/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter11/public/logo512.png
--------------------------------------------------------------------------------
/Chapter11/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 |
--------------------------------------------------------------------------------
/Chapter11/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter11/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 |
--------------------------------------------------------------------------------
/Chapter11/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import AppBar from '@mui/material/AppBar';
3 | import Toolbar from '@mui/material/Toolbar';
4 | import Typography from '@mui/material/Typography';
5 | import Carlist from './components/Carlist';
6 |
7 | function App() {
8 | return (
9 |
10 |
11 |
12 |
13 | Carshop
14 |
15 |
16 |
17 |
18 |
19 | );
20 | }
21 |
22 | export default App;
23 |
--------------------------------------------------------------------------------
/Chapter11/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter11/src/components/AddCar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Dialog from '@mui/material/Dialog';
3 | import DialogActions from '@mui/material/DialogActions';
4 | import DialogContent from '@mui/material/DialogContent';
5 | import DialogTitle from '@mui/material/DialogTitle';
6 |
7 | function AddCar(props) {
8 | const [open, setOpen] = useState(false);
9 | const [car, setCar] = useState({
10 | brand: '',
11 | model: '',
12 | color: '',
13 | year: '',
14 | fuel: '',
15 | price: ''
16 | });
17 |
18 | // Open the modal form
19 | const handleClickOpen = () => {
20 | setOpen(true);
21 | };
22 |
23 | // Close the modal form
24 | const handleClose = () => {
25 | setOpen(false);
26 | };
27 |
28 | // Save car and close modal form
29 | const handleSave = () => {
30 | props.addCar(car);
31 | handleClose();
32 | }
33 |
34 | const handleChange = (event) => {
35 | setCar({...car, [event.target.name]: event.target.value});
36 | }
37 |
38 | return(
39 |
40 | New Car
41 |
42 | New car
43 |
44 |
46 |
48 |
50 |
52 |
54 |
55 |
56 | Cancel
57 | Save
58 |
59 |
60 |
61 | );
62 | }
63 |
64 | export default AddCar;
65 |
--------------------------------------------------------------------------------
/Chapter11/src/components/EditCar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Dialog from '@mui/material/Dialog';
3 | import DialogActions from '@mui/material/DialogActions';
4 | import DialogContent from '@mui/material/DialogContent';
5 | import DialogTitle from '@mui/material/DialogTitle';
6 |
7 | function EditCar(props) {
8 | const [open, setOpen] = useState(false);
9 | const [car, setCar] = useState({
10 | brand: '', model: '', color: '',
11 | year: '', fuel:'', price: ''
12 | });
13 |
14 | // Open the modal form and update the car state
15 | const handleClickOpen = () => {
16 | setCar({
17 | brand: props.data.row.brand,
18 | model: props.data.row.model,
19 | color: props.data.row.color,
20 | year: props.data.row.year,
21 | fuel: props.data.row.fuel,
22 | price: props.data.row.price
23 | })
24 | setOpen(true);
25 | }
26 |
27 | // Close the modal form
28 | const handleClose = () => {
29 | setOpen(false);
30 | };
31 |
32 | const handleChange = (event) => {
33 | setCar({...car,
34 | [event.target.name]: event.target.value});
35 | }
36 |
37 | // Update car and close modal form
38 | const handleSave = () => {
39 | props.updateCar(car, props.data.id);
40 | handleClose();
41 | }
42 |
43 | return(
44 |
45 | Edit
46 |
47 | Edit car
48 |
49 |
51 |
53 |
55 |
57 |
59 |
60 |
61 | Cancel
62 | Save
63 |
64 |
65 |
66 | );
67 | }
68 |
69 | export default EditCar;
70 |
--------------------------------------------------------------------------------
/Chapter11/src/constants.js:
--------------------------------------------------------------------------------
1 | export const SERVER_URL='http://localhost:8080/';
--------------------------------------------------------------------------------
/Chapter11/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 |
--------------------------------------------------------------------------------
/Chapter11/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import * as ReactDOMClient from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const container = document.getElementById('root');
8 |
9 | // Create a root.
10 | const root = ReactDOMClient.createRoot(container);
11 |
12 | root.render(
13 |
14 |
15 |
16 | );
17 |
18 | // If you want to start measuring performance in your app, pass a function
19 | // to log results (for example: reportWebVitals(console.log))
20 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
21 | reportWebVitals();
22 |
--------------------------------------------------------------------------------
/Chapter11/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter11/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter11/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';
6 |
--------------------------------------------------------------------------------
/Chapter12/.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 |
--------------------------------------------------------------------------------
/Chapter12/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "carmuigrid",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@emotion/react": "^11.9.0",
7 | "@emotion/styled": "^11.8.1",
8 | "@mui/icons-material": "^5.6.2",
9 | "@mui/material": "^5.6.2",
10 | "@mui/x-data-grid": "^5.9.0",
11 | "@testing-library/jest-dom": "^5.16.1",
12 | "@testing-library/react": "^13.1.1",
13 | "@testing-library/user-event": "^13.5.0",
14 | "react": "^18.0.0",
15 | "react-dom": "^18.0.0",
16 | "react-scripts": "^5.0.1",
17 | "web-vitals": "^2.1.2"
18 | },
19 | "scripts": {
20 | "start": "react-scripts start",
21 | "build": "react-scripts build",
22 | "test": "react-scripts test",
23 | "eject": "react-scripts eject"
24 | },
25 | "eslintConfig": {
26 | "extends": [
27 | "react-app",
28 | "react-app/jest"
29 | ]
30 | },
31 | "browserslist": {
32 | "production": [
33 | ">0.2%",
34 | "not dead",
35 | "not op_mini all"
36 | ],
37 | "development": [
38 | "last 1 chrome version",
39 | "last 1 firefox version",
40 | "last 1 safari version"
41 | ]
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Chapter12/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter12/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter12/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 |
--------------------------------------------------------------------------------
/Chapter12/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter12/public/logo192.png
--------------------------------------------------------------------------------
/Chapter12/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter12/public/logo512.png
--------------------------------------------------------------------------------
/Chapter12/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 |
--------------------------------------------------------------------------------
/Chapter12/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter12/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 |
--------------------------------------------------------------------------------
/Chapter12/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import AppBar from '@mui/material/AppBar';
3 | import Toolbar from '@mui/material/Toolbar';
4 | import Typography from '@mui/material/Typography';
5 | import Carlist from './components/Carlist';
6 |
7 | function App() {
8 | return (
9 |
10 |
11 |
12 |
13 | Carshop
14 |
15 |
16 |
17 |
18 |
19 | );
20 | }
21 |
22 | export default App;
23 |
--------------------------------------------------------------------------------
/Chapter12/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter12/src/components/AddCar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Dialog from '@mui/material/Dialog';
3 | import DialogActions from '@mui/material/DialogActions';
4 | import DialogContent from '@mui/material/DialogContent';
5 | import DialogTitle from '@mui/material/DialogTitle';
6 | import Button from '@mui/material/Button';
7 | import TextField from '@mui/material/TextField';
8 | import Stack from '@mui/material/Stack';
9 |
10 | function AddCar(props) {
11 | const [open, setOpen] = useState(false);
12 | const [car, setCar] = useState({
13 | brand: '',
14 | model: '',
15 | color: '',
16 | year: '',
17 | fuel: '',
18 | price: ''
19 | });
20 |
21 | // Open the modal form
22 | const handleClickOpen = () => {
23 | setOpen(true);
24 | };
25 |
26 | // Close the modal form
27 | const handleClose = () => {
28 | setOpen(false);
29 | };
30 |
31 | // Save car and close modal form
32 | const handleSave = () => {
33 | props.addCar(car);
34 | handleClose();
35 | }
36 |
37 | const handleChange = (event) => {
38 | setCar({...car, [event.target.name]: event.target.value});
39 | }
40 |
41 | return(
42 |
43 |
44 | New Car
45 |
46 |
47 | New car
48 |
49 |
50 |
53 |
56 |
59 |
62 |
65 |
66 |
67 |
68 | Cancel
69 | Save
70 |
71 |
72 |
73 | );
74 | }
75 |
76 | export default AddCar;
77 |
--------------------------------------------------------------------------------
/Chapter12/src/components/EditCar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Dialog from '@mui/material/Dialog';
3 | import DialogActions from '@mui/material/DialogActions';
4 | import DialogContent from '@mui/material/DialogContent';
5 | import DialogTitle from '@mui/material/DialogTitle';
6 | import Button from '@mui/material/Button';
7 | import IconButton from '@mui/material/IconButton';
8 | import EditIcon from '@mui/icons-material/Edit';
9 | import TextField from '@mui/material/TextField';
10 | import Stack from '@mui/material/Stack';
11 |
12 | function EditCar(props) {
13 | const [open, setOpen] = useState(false);
14 | const [car, setCar] = useState({
15 | brand: '', model: '', color: '',
16 | year: '', fuel:'', price: ''
17 | });
18 |
19 | // Open the modal form and update the car state
20 | const handleClickOpen = () => {
21 | setCar({
22 | brand: props.data.row.brand,
23 | model: props.data.row.model,
24 | color: props.data.row.color,
25 | year: props.data.row.year,
26 | fuel: props.data.row.fuel,
27 | price: props.data.row.price
28 | })
29 | setOpen(true);
30 | }
31 |
32 | // Close the modal form
33 | const handleClose = () => {
34 | setOpen(false);
35 | };
36 |
37 | const handleChange = (event) => {
38 | setCar({...car,
39 | [event.target.name]: event.target.value});
40 | }
41 |
42 | // Update car and close modal form
43 | const handleSave = () => {
44 | props.updateCar(car, props.data.id);
45 | handleClose();
46 | }
47 |
48 | return(
49 |
50 |
51 |
52 |
53 |
54 | Edit car
55 |
56 |
57 |
60 |
63 |
66 |
69 |
72 |
73 |
74 |
75 | Cancel
76 | Save
77 |
78 |
79 |
80 | );
81 | }
82 |
83 | export default EditCar;
84 |
--------------------------------------------------------------------------------
/Chapter12/src/constants.js:
--------------------------------------------------------------------------------
1 | export const SERVER_URL='http://localhost:8080/';
--------------------------------------------------------------------------------
/Chapter12/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 |
--------------------------------------------------------------------------------
/Chapter12/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import * as ReactDOMClient from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const container = document.getElementById('root');
8 |
9 | // Create a root.
10 | const root = ReactDOMClient.createRoot(container);
11 |
12 | root.render(
13 |
14 |
15 |
16 | );
17 |
18 | // If you want to start measuring performance in your app, pass a function
19 | // to log results (for example: reportWebVitals(console.log))
20 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
21 | reportWebVitals();
22 |
--------------------------------------------------------------------------------
/Chapter12/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter12/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter12/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';
6 |
--------------------------------------------------------------------------------
/Chapter13/.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 |
--------------------------------------------------------------------------------
/Chapter13/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "carmuigrid",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@emotion/react": "^11.9.0",
7 | "@emotion/styled": "^11.8.1",
8 | "@mui/icons-material": "^5.6.2",
9 | "@mui/material": "^5.6.2",
10 | "@mui/x-data-grid": "^5.9.0",
11 | "@testing-library/jest-dom": "^5.16.1",
12 | "@testing-library/react": "^13.1.1",
13 | "@testing-library/user-event": "^13.5.0",
14 | "react": "^18.0.0",
15 | "react-dom": "^18.0.0",
16 | "react-scripts": "^5.0.1",
17 | "web-vitals": "^2.1.2"
18 | },
19 | "scripts": {
20 | "start": "react-scripts start",
21 | "build": "react-scripts build",
22 | "test": "react-scripts test",
23 | "eject": "react-scripts eject"
24 | },
25 | "eslintConfig": {
26 | "extends": [
27 | "react-app",
28 | "react-app/jest"
29 | ]
30 | },
31 | "browserslist": {
32 | "production": [
33 | ">0.2%",
34 | "not dead",
35 | "not op_mini all"
36 | ],
37 | "development": [
38 | "last 1 chrome version",
39 | "last 1 firefox version",
40 | "last 1 safari version"
41 | ]
42 | },
43 | "devDependencies": {
44 | "react-test-renderer": "^18.0.0"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Chapter13/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter13/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter13/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 |
--------------------------------------------------------------------------------
/Chapter13/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter13/public/logo192.png
--------------------------------------------------------------------------------
/Chapter13/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter13/public/logo512.png
--------------------------------------------------------------------------------
/Chapter13/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 |
--------------------------------------------------------------------------------
/Chapter13/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter13/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 |
--------------------------------------------------------------------------------
/Chapter13/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import AppBar from '@mui/material/AppBar';
3 | import Toolbar from '@mui/material/Toolbar';
4 | import Typography from '@mui/material/Typography';
5 | import Carlist from './components/Carlist';
6 |
7 | function App() {
8 | return (
9 |
10 |
11 |
12 |
13 | Carshop
14 |
15 |
16 |
17 |
18 |
19 | );
20 | }
21 |
22 | export default App;
23 |
--------------------------------------------------------------------------------
/Chapter13/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen, fireEvent } from '@testing-library/react';
2 | import App from './App';
3 | import AddCar from './components/AddCar';
4 | import TestRenderer from 'react-test-renderer';
5 |
6 | test('renders a snapshot', () => {
7 | const tree = TestRenderer.create( ).toJSON();
8 | expect(tree).toMatchSnapshot();
9 | });
10 |
11 | test('open add car modal form', async () => {
12 | render( );
13 | fireEvent.click(screen.getByText('New Car'));
14 | expect(screen.getByRole('dialog')).toHaveTextContent('New car');
15 | });
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Chapter13/src/__snapshots__/App.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`renders a snapshot 1`] = `
4 |
5 |
24 | New Car
25 |
26 |
27 | `;
28 |
--------------------------------------------------------------------------------
/Chapter13/src/components/AddCar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Dialog from '@mui/material/Dialog';
3 | import DialogActions from '@mui/material/DialogActions';
4 | import DialogContent from '@mui/material/DialogContent';
5 | import DialogTitle from '@mui/material/DialogTitle';
6 | import Button from '@mui/material/Button';
7 | import TextField from '@mui/material/TextField';
8 | import Stack from '@mui/material/Stack';
9 |
10 | function AddCar(props) {
11 | const [open, setOpen] = useState(false);
12 | const [car, setCar] = useState({
13 | brand: '',
14 | model: '',
15 | color: '',
16 | year: '',
17 | fuel: '',
18 | price: ''
19 | });
20 |
21 | // Open the modal form
22 | const handleClickOpen = () => {
23 | setOpen(true);
24 | };
25 |
26 | // Close the modal form
27 | const handleClose = () => {
28 | setOpen(false);
29 | };
30 |
31 | // Save car and close modal form
32 | const handleSave = () => {
33 | props.addCar(car);
34 | handleClose();
35 | }
36 |
37 | const handleChange = (event) => {
38 | setCar({...car, [event.target.name]: event.target.value});
39 | }
40 |
41 | return(
42 |
43 |
44 | New Car
45 |
46 |
47 | New car
48 |
49 |
50 |
53 |
56 |
59 |
62 |
65 |
66 |
67 |
68 | Cancel
69 | Save
70 |
71 |
72 |
73 | );
74 | }
75 |
76 | export default AddCar;
77 |
--------------------------------------------------------------------------------
/Chapter13/src/constants.js:
--------------------------------------------------------------------------------
1 | export const SERVER_URL='http://localhost:8080/';
--------------------------------------------------------------------------------
/Chapter13/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 |
--------------------------------------------------------------------------------
/Chapter13/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import * as ReactDOMClient from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const container = document.getElementById('root');
8 |
9 | // Create a root.
10 | const root = ReactDOMClient.createRoot(container);
11 |
12 | root.render(
13 |
14 |
15 |
16 | );
17 |
18 | // If you want to start measuring performance in your app, pass a function
19 | // to log results (for example: reportWebVitals(console.log))
20 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
21 | reportWebVitals();
22 |
--------------------------------------------------------------------------------
/Chapter13/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter13/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter13/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';
6 |
--------------------------------------------------------------------------------
/Chapter14/.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 |
--------------------------------------------------------------------------------
/Chapter14/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "carmuigrid",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@emotion/react": "^11.9.0",
7 | "@emotion/styled": "^11.8.1",
8 | "@mui/icons-material": "^5.6.2",
9 | "@mui/material": "^5.6.2",
10 | "@mui/x-data-grid": "^5.9.0",
11 | "@testing-library/jest-dom": "^5.16.1",
12 | "@testing-library/react": "^13.1.1",
13 | "@testing-library/user-event": "^13.5.0",
14 | "react": "^18.0.0",
15 | "react-dom": "^18.0.0",
16 | "react-scripts": "^5.0.1",
17 | "web-vitals": "^2.1.2"
18 | },
19 | "scripts": {
20 | "start": "react-scripts start",
21 | "build": "react-scripts build",
22 | "test": "react-scripts test",
23 | "eject": "react-scripts eject"
24 | },
25 | "eslintConfig": {
26 | "extends": [
27 | "react-app",
28 | "react-app/jest"
29 | ]
30 | },
31 | "browserslist": {
32 | "production": [
33 | ">0.2%",
34 | "not dead",
35 | "not op_mini all"
36 | ],
37 | "development": [
38 | "last 1 chrome version",
39 | "last 1 firefox version",
40 | "last 1 safari version"
41 | ]
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Chapter14/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter14/public/favicon.ico
--------------------------------------------------------------------------------
/Chapter14/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 |
--------------------------------------------------------------------------------
/Chapter14/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter14/public/logo192.png
--------------------------------------------------------------------------------
/Chapter14/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Full-Stack-Development-with-Spring-Boot-and-React/f2f6d3034bb30f1d0faa5d6133047e5dd298a672/Chapter14/public/logo512.png
--------------------------------------------------------------------------------
/Chapter14/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 |
--------------------------------------------------------------------------------
/Chapter14/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Chapter14/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 |
--------------------------------------------------------------------------------
/Chapter14/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import AppBar from '@mui/material/AppBar';
3 | import Toolbar from '@mui/material/Toolbar';
4 | import Typography from '@mui/material/Typography';
5 | import Login from './components/Login';
6 |
7 | function App() {
8 | return (
9 |
10 |
11 |
12 |
13 | Carshop
14 |
15 |
16 |
17 |
18 |
19 | );
20 | }
21 |
22 | export default App;
23 |
--------------------------------------------------------------------------------
/Chapter14/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render( );
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/Chapter14/src/components/AddCar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Dialog from '@mui/material/Dialog';
3 | import DialogActions from '@mui/material/DialogActions';
4 | import DialogContent from '@mui/material/DialogContent';
5 | import DialogTitle from '@mui/material/DialogTitle';
6 | import Button from '@mui/material/Button';
7 | import TextField from '@mui/material/TextField';
8 | import Stack from '@mui/material/Stack';
9 |
10 | function AddCar(props) {
11 | const [open, setOpen] = useState(false);
12 | const [car, setCar] = useState({
13 | brand: '',
14 | model: '',
15 | color: '',
16 | year: '',
17 | fuel: '',
18 | price: ''
19 | });
20 |
21 | // Open the modal form
22 | const handleClickOpen = () => {
23 | setOpen(true);
24 | };
25 |
26 | // Close the modal form
27 | const handleClose = () => {
28 | setOpen(false);
29 | };
30 |
31 | const handleChange = (event) => {
32 | setCar({...car, [event.target.name]: event.target.value});
33 | }
34 |
35 | // Save car and close modal form
36 | const handleSave = () => {
37 | props.addCar(car);
38 | handleClose();
39 | }
40 |
41 | return(
42 |
43 |
44 | New Car
45 |
46 |
47 | New car
48 |
49 |
50 |
53 |
56 |
59 |
62 |
65 |
66 |
67 |
68 | Cancel
69 | Save
70 |
71 |
72 |
73 | );
74 | }
75 |
76 | export default AddCar;
77 |
--------------------------------------------------------------------------------
/Chapter14/src/components/EditCar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Dialog from '@mui/material/Dialog';
3 | import DialogActions from '@mui/material/DialogActions';
4 | import DialogContent from '@mui/material/DialogContent';
5 | import DialogTitle from '@mui/material/DialogTitle';
6 | import Button from '@mui/material/Button';
7 | import IconButton from '@mui/material/IconButton';
8 | import EditIcon from '@mui/icons-material/Edit';
9 | import TextField from '@mui/material/TextField';
10 | import Stack from '@mui/material/Stack';
11 |
12 | function EditCar(props) {
13 | const [open, setOpen] = useState(false);
14 | const [car, setCar] = useState({
15 | brand: '', model: '', color: '',
16 | year: '', fuel:'', price: ''
17 | });
18 |
19 | // Open the modal form and update the car state
20 | const handleClickOpen = () => {
21 | setCar({
22 | brand: props.data.row.brand,
23 | model: props.data.row.model,
24 | color: props.data.row.color,
25 | year: props.data.row.year,
26 | fuel: props.data.row.fuel,
27 | price: props.data.row.price
28 | })
29 | setOpen(true);
30 | }
31 |
32 | // Close the modal form
33 | const handleClose = () => {
34 | setOpen(false);
35 | };
36 |
37 | const handleChange = (event) => {
38 | setCar({...car,
39 | [event.target.name]: event.target.value});
40 | }
41 |
42 | // Update car and close modal form
43 | const handleSave = () => {
44 | props.updateCar(car, props.data.id);
45 | handleClose();
46 | }
47 |
48 | return(
49 |
50 |
51 |
52 |
53 |
54 | Edit car
55 |
56 |
57 |
60 |
63 |
66 |
69 |
72 |
73 |
74 |
75 | Cancel
76 | Save
77 |
78 |
79 |
80 | );
81 | }
82 |
83 | export default EditCar;
--------------------------------------------------------------------------------
/Chapter14/src/components/Login.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import Button from '@mui/material/Button';
3 | import TextField from '@mui/material/TextField';
4 | import Stack from '@mui/material/Stack';
5 | import Carlist from './Carlist';
6 | import Snackbar from '@mui/material/Snackbar';
7 |
8 | import { SERVER_URL } from '../constants.js';
9 |
10 | function Login() {
11 | const [user, setUser] = useState({
12 | username: '',
13 | password: ''
14 | });
15 | const [isAuthenticated, setAuth] = useState(false);
16 | const [open, setOpen] = useState(false);
17 |
18 | const handleChange = (event) => {
19 | setUser({...user, [event.target.name] : event.target.value});
20 | }
21 |
22 | const login = () => {
23 | fetch(SERVER_URL + 'login', {
24 | method: 'POST',
25 | headers: { 'Content-Type':'application/json' },
26 | body: JSON.stringify(user)
27 | })
28 | .then(res => {
29 | const jwtToken = res.headers.get('Authorization');
30 | if (jwtToken !== null) {
31 | sessionStorage.setItem("jwt", jwtToken);
32 | setAuth(true);
33 | }
34 | else {
35 | setOpen(true);
36 | }
37 | })
38 | .catch(err => console.error(err))
39 | }
40 |
41 | if (isAuthenticated) {
42 | return ;
43 | }
44 | else {
45 | return(
46 |
47 |
48 |
52 |
57 |
61 | Login
62 |
63 |
64 | setOpen(false)}
68 | message="Login failed: Check your username and password"
69 | />
70 |
71 | );
72 | }
73 | }
74 |
75 | export default Login;
76 |
--------------------------------------------------------------------------------
/Chapter14/src/constants.js:
--------------------------------------------------------------------------------
1 | export const SERVER_URL='http://localhost:8080/';
--------------------------------------------------------------------------------
/Chapter14/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 |
--------------------------------------------------------------------------------
/Chapter14/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import * as ReactDOMClient from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const container = document.getElementById('root');
8 | // Create a root.
9 | const root = ReactDOMClient.createRoot(container);
10 |
11 | root.render(
12 |
13 |
14 |
15 | );
16 |
17 | // If you want to start measuring performance in your app, pass a function
18 | // to log results (for example: reportWebVitals(console.log))
19 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
20 | reportWebVitals();
21 |
--------------------------------------------------------------------------------
/Chapter14/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Chapter14/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/Chapter14/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';
6 |
--------------------------------------------------------------------------------
/Chapter15/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM adoptopenjdk/openjdk11:latest
2 | VOLUME /tmp
3 | EXPOSE 8080
4 | ARG JAR FILE
5 | COPY target/cardatabase-0.0.1-SNAPSHOT.jar app.jar
6 | ENTRYPOINT ["java","-jar","/app.jar"]
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Packt
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------