Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing configuration to run app #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions material-react-app/.env.example

This file was deleted.

7,021 changes: 3,645 additions & 3,376 deletions material-react-app/package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions material-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"react-chartjs-2": "3.0.4",
"react-dom": "^17.0.2",
"react-github-btn": "1.2.1",
"react-meta-tags": "^1.0.1",
"react-router-dom": "6.2.1",
"react-scripts": "5.0.0",
"react-table": "7.7.0",
Expand Down Expand Up @@ -66,5 +65,5 @@
"prettier": "2.5.1"
},
"homepage": "https://material-dashboard-react-nodejs.creative-tim.com/",
"proxy": "https://node-json-api-free.creative-tim.com/"
"proxy": "http://localhost:8080"
}
60 changes: 1 addition & 59 deletions material-react-app/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import Register from "auth/register";
import { AuthContext } from "context";
import UserProfile from "layouts/user-profile";
import UserManagement from "layouts/user-management";
import MetaTags from 'react-meta-tags'
//import MetaTags from 'react-meta-tags'

export default function App() {
const authContext = useContext(AuthContext);
Expand Down Expand Up @@ -169,64 +169,6 @@ export default function App() {

return (
<>
{isDemo && (
<MetaTags>
<meta
name="keywords"
content="creative tim, updivision, material, node.js json:api, html dashboard, node.js, react, api admin, react node.js, html css dashboard node.js, material dashboard node.js, node.js api, react material dashboard, material admin, react dashboard, react admin, web dashboard, bootstrap 5 dashboard node.js, bootstrap 5, css3 dashboard, bootstrap 5 admin node.js, material dashboard bootstrap 5 node.js, frontend, api dashboard, responsive bootstrap 5 dashboard, api, material dashboard, material node.js bootstrap 5 dashboard, json:api"
/>
<meta
name="description"
content="A free full stack app powered by MUI component library, React and Node.js API, featuring dozens of handcrafted UI elements"
/>
<meta
itemProp="name"
content="Material Dashboard 2 React Node.js by Creative Tim & UPDIVISION"
/>
<meta
itemProp="description"
content="A free full stack app powered by MUI component library, React and Node.js API, featuring dozens of handcrafted UI elements"
/>
<meta
itemProp="image"
content="https://s3.amazonaws.com/creativetim_bucket/products/157/original/react-material-dashboard-nodejs.jpg?1664786816"
/>
<meta name="twitter:card" content="product" />
<meta name="twitter:site" content="@creativetim" />
<meta
name="twitter:title"
content="Material Dashboard 2 React Node.js by Creative Tim & UPDIVISION"
/>
<meta
name="twitter:description"
content="A free full stack app powered by MUI component library, React and Node.js API, featuring dozens of handcrafted UI elements"
/>
<meta name="twitter:creator" content="@creativetim" />
<meta
name="twitter:image"
content="https://s3.amazonaws.com/creativetim_bucket/products/157/original/react-material-dashboard-nodejs.jpg?1664786816"
/>
<meta property="fb:app_id" content="655968634437471" />
<meta
property="og:title"
content="Material Dashboard 2 React Node.js by Creative Tim & UPDIVISION"
/>
<meta property="og:type" content="article" />
<meta
property="og:url"
content="https://www.creative-tim.com/live/react-material-dashboard-node.js/"
/>
<meta
property="og:image"
content="https://s3.amazonaws.com/creativetim_bucket/products/157/original/react-material-dashboard-nodejs.jpg?1664786816"
/>
<meta
property="og:description"
content="A free full stack app powered by MUI component library, React and Node.js API, featuring dozens of handcrafted UI elements"
/>
<meta property="og:site_name" content="Creative Tim" />
</MetaTags>
)}
{direction === "rtl" ? (
<CacheProvider value={rtlCache}>
<ThemeProvider theme={darkMode ? themeDarkRTL : themeRTL}>
Expand Down
9 changes: 0 additions & 9 deletions node-api/.env.example

This file was deleted.

2 changes: 1 addition & 1 deletion node-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dotenv": "^16.0.1",
"express": "^4.18.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.5.0",
"mongoose": "^6.7.0",
"mysql": "^2.18.1",
"mysql2": "^2.3.3",
"node-cron": "^3.0.2",
Expand Down
6 changes: 3 additions & 3 deletions node-api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import bodyParser from "body-parser";
import cors from "cors";
import dotenv from "dotenv";
import "./passport.js";
import { dbConnect } from "./mongo";
import { meRoutes, authRoutes } from "./routes";
import { dbConnect } from "./mongo/index.js";
import { meRoutes, authRoutes } from "./routes/index.js";
import path from "path";
import * as fs from "fs";
import cron from "node-cron";
import ReseedAction from "./mongo/ReseedAction";
import ReseedAction from "./mongo/ReseedAction.js";

dotenv.config();

Expand Down
13 changes: 10 additions & 3 deletions node-api/src/mongo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ import dotenv from "dotenv";
dotenv.config();

export const dbConnect = () => {
mongoose.connection.once("open", () => console.log("DB connection"));
mongoose.connection.once("open", () => console.log("DB connection"));
console.log(`Attempting to connect to: ${process.env.DB_LINK}`);

console.log("***************************");
console.log(process.env.DB_LINK.startsWith("mongodb+srv://"));
console.log("***************************");

return mongoose.connect(
`mongodb+srv://${process.env.DB_LINK}?retryWrites=true&w=majority`,
{ keepAlive: true }
process.env.DB_LINK,
{ keepAlive: true}
);

};
2 changes: 1 addition & 1 deletion node-api/src/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import passportJWT from "passport-jwt";
import dotenv from "dotenv";
import passport from "passport";

import { userModel } from "./schemas/user.schema";
import { userModel } from "./schemas/user.schema.js";
const JWTStrategy = passportJWT.Strategy;
dotenv.config();

Expand Down
2 changes: 1 addition & 1 deletion node-api/src/routes/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
loginRouteHandler,
registerRouteHandler,
resetPasswordRouteHandler,
} from "../../services/auth";
} from "../../services/auth/index.js";

const router = express.Router();

Expand Down
6 changes: 3 additions & 3 deletions node-api/src/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import userRoutes from './users';
import meRoutes from './me';
import authRoutes from './auth';
import userRoutes from './users/index.js';
import meRoutes from './me/index.js';
import authRoutes from './auth/index.js';

export { userRoutes, meRoutes, authRoutes };
2 changes: 1 addition & 1 deletion node-api/src/routes/me/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import passport from "passport";
import jwt from 'jsonwebtoken';

const router = express.Router();
import { getProfileRouteHandler, patchProfileRouteHandler } from "../../services/me";
import { getProfileRouteHandler, patchProfileRouteHandler } from "../../services/me/index.js";

// get user's profile
router.get("/", passport.authenticate('jwt',{session: false}), (req, res) => {
Expand Down
2 changes: 1 addition & 1 deletion node-api/src/services/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import dotenv from "dotenv";
import nodemailer from "nodemailer";
import randomToken from "random-token";
import bcrypt from "bcrypt";
import { userModel } from "../../schemas/user.schema";
import { userModel } from "../../schemas/user.schema.js";
import jwt from 'jsonwebtoken';

dotenv.config();
Expand Down
2 changes: 1 addition & 1 deletion node-api/src/services/me/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import bcrypt from "bcrypt";
import dotenv from 'dotenv';
import { userModel } from "../../schemas/user.schema";
import { userModel } from "../../schemas/user.schema.js";
import jwt from 'jsonwebtoken';

dotenv.config();
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}