Skip to content

Commit

Permalink
Add missing client code & service-worker template parts.
Browse files Browse the repository at this point in the history
resolves #18 resolves #19 resolves #20
  • Loading branch information
Poikilos committed Dec 5, 2020
1 parent ae0f8bd commit a20ba8c
Show file tree
Hide file tree
Showing 13 changed files with 5,681 additions and 729 deletions.
6,333 changes: 5,635 additions & 698 deletions client/package-lock.json

Large diffs are not rendered by default.

28 changes: 19 additions & 9 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,40 @@
"private": true,
"proxy": "http://localhost:5000",
"dependencies": {
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.1",
"@testing-library/user-event": "^12.2.0",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.5.0",
"axios": "^0.21.0",
"chokidar-cli": "^2.1.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.1.14",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.0",
"react-scripts": "4.0.1",
"react-validation": "^3.0.7",
"tailwindcss": "^2.0.1",
"validator": "^13.1.17",
"web-vitals": "^0.2.4"
"validator": "^13.5.1",
"web-vitals": "^0.2.4",
"workbox-background-sync": "^5.1.4",
"workbox-broadcast-update": "^5.1.4",
"workbox-cacheable-response": "^5.1.4",
"workbox-core": "^5.1.4",
"workbox-expiration": "^5.1.4",
"workbox-google-analytics": "^5.1.4",
"workbox-navigation-preload": "^5.1.4",
"workbox-precaching": "^5.1.4",
"workbox-range-requests": "^5.1.4",
"workbox-routing": "^5.1.4",
"workbox-strategies": "^5.1.4",
"workbox-streams": "^5.1.4"
},
"scripts": {
"build:tailwind": "tailwind build src/tailwind.css -o src/tailwind.output.css",
"watch:tailwind": "chokidar 'src/**/*.css' 'src/**/*.scss' --ignore src/tailwind.output.css -c 'npm run build:tailwind'",

"start": "npm-run-all build:tailwind --parallel watch:tailwind start:react",
"start:react": "react-scripts start",

"prebuild": "run-s build:tailwind",

"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
Expand Down
9 changes: 2 additions & 7 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ import BoardUser from "./components/board-user.component";
import BoardModerator from "./components/board-moderator.component";
import BoardAdmin from "./components/board-admin.component";

class App extends Component {
render() {
// ...
}
}

class App extends Component {
constructor(props) {
Expand Down Expand Up @@ -55,7 +50,7 @@ class App extends Component {
<div>
<nav className="navbar navbar-expand navbar-dark bg-dark">
<Link to={"/"} className="navbar-brand">
bezKoder
ArtSpatter
</Link>
<div className="navbar-nav mr-auto">
<li className="nav-item">
Expand Down Expand Up @@ -137,4 +132,4 @@ class App extends Component {

export default App;

// (BezKoder, 2019)
// (BezKoder, 2019b)
16 changes: 13 additions & 3 deletions client/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';

// import './index.css'; // generated, but I commented it
import App from './App';
import * as serviceWorker from './serviceWorker';
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
// import reportWebVitals from './reportWebVitals'; // generated, but I commented it

ReactDOM.render(
<BrowserRouter>
Expand All @@ -12,4 +13,13 @@ ReactDOM.render(
document.getElementById('root')
);

serviceWorker.unregister();
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://cra.link/PWA
serviceWorkerRegistration.unregister();

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
// reportWebVitals(); // generated, but I commented it

2 changes: 1 addition & 1 deletion controllers/auth.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ exports.signin = (req, res) => {
});
};

// (BezKoder, 2019)
// (BezKoder, 2019a)
2 changes: 1 addition & 1 deletion controllers/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ exports.moderatorBoard = (req, res) => {
res.status(200).send("Moderator Content.");
};

// (BezKoder, 2019)
// (BezKoder, 2019a)
2 changes: 1 addition & 1 deletion middlewares/authJwt.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ const authJwt = {
};
module.exports = authJwt;

// (BezKoder, 2019)
// (BezKoder, 2019a)
2 changes: 1 addition & 1 deletion middlewares/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ module.exports = {
verifySignUp
};

// (BezKoder, 2019)
// (BezKoder, 2019a)
2 changes: 1 addition & 1 deletion middlewares/verifySignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ const verifySignUp = {

module.exports = verifySignUp;

// (BezKoder, 2019)
// (BezKoder, 2019a)
2 changes: 1 addition & 1 deletion models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ db.ROLES = ["user", "admin", "moderator"];

module.exports = db;

// (BezKoder, 2019)
// (BezKoder, 2019a)
2 changes: 1 addition & 1 deletion routes/auth.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ module.exports = function(app) {
app.post("/api/auth/signin", controller.signin);
};

// (BezKoder, 2019)
// (BezKoder, 2019a)
2 changes: 1 addition & 1 deletion routes/user.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ module.exports = function(app) {
);
};

// (BezKoder, 2019)
// (BezKoder, 2019a)
8 changes: 4 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const app = express();

var corsOptions = {
origin: "http://localhost:3000",
} // (BezKoder, 2019)
} // (BezKoder, 2019a)

app.use(cors(corsOptions));

Expand All @@ -24,7 +24,7 @@ const dbConfig = require('./config/db.config'); // automatically imported
// connect to the database
db.mongoose.connect(`mongodb://${dbConfig.HOST}:${dbConfig.PORT}/${dbConfig.DB}`, {
useNewUrlParser: true,
useUnifiedTopology: true, // (BezKoder, 2019)
useUnifiedTopology: true, // (BezKoder, 2019a)
})
.then(() => {
console.log('MongoDB is successfully connected.');
Expand All @@ -38,7 +38,7 @@ db.mongoose.connect(`mongodb://${dbConfig.HOST}:${dbConfig.PORT}/${dbConfig.DB}`
app.use(bodyParser.json());

// parse requests of content-type - application/x-www-form-urlencoded
// as per BezKoder (2019).
// as per BezKoder (2019a).
app.use(bodyParser.urlencoded({ extended: true }));
/* app.use('/api', routes);
Expand Down Expand Up @@ -93,4 +93,4 @@ function initial() {
});
}
});
} // (BezKoder, 2019)
} // (BezKoder, 2019a)

0 comments on commit a20ba8c

Please sign in to comment.