create-express-react-mongo 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -0
- package/bin/index.ts +60 -0
- package/dist/index.js +42 -0
- package/package.json +36 -0
- package/templates/default/client/README.md +1 -0
- package/templates/default/client/eslint.config.js +28 -0
- package/templates/default/client/index.html +15 -0
- package/templates/default/client/package-lock.json +4159 -0
- package/templates/default/client/package.json +32 -0
- package/templates/default/client/public/vite.svg +1 -0
- package/templates/default/client/src/App.css +4 -0
- package/templates/default/client/src/App.d.ts +4 -0
- package/templates/default/client/src/App.d.ts.map +1 -0
- package/templates/default/client/src/App.js +17 -0
- package/templates/default/client/src/App.js.map +1 -0
- package/templates/default/client/src/App.tsx +28 -0
- package/templates/default/client/src/components/index.d.ts +5 -0
- package/templates/default/client/src/components/index.d.ts.map +1 -0
- package/templates/default/client/src/components/index.js +7 -0
- package/templates/default/client/src/components/index.js.map +1 -0
- package/templates/default/client/src/components/index.tsx +12 -0
- package/templates/default/client/src/index.css +19 -0
- package/templates/default/client/src/main.d.ts +2 -0
- package/templates/default/client/src/main.d.ts.map +1 -0
- package/templates/default/client/src/main.js +7 -0
- package/templates/default/client/src/main.js.map +1 -0
- package/templates/default/client/src/main.tsx +10 -0
- package/templates/default/client/src/services/initialContent.d.ts +6 -0
- package/templates/default/client/src/services/initialContent.d.ts.map +1 -0
- package/templates/default/client/src/services/initialContent.js +30 -0
- package/templates/default/client/src/services/initialContent.js.map +1 -0
- package/templates/default/client/src/services/initialContent.ts +30 -0
- package/templates/default/client/src/vite-env.d.ts +3 -0
- package/templates/default/client/tsconfig.json +24 -0
- package/templates/default/client/tsconfig.node.json +10 -0
- package/templates/default/client/vite.config.d.ts +3 -0
- package/templates/default/client/vite.config.d.ts.map +1 -0
- package/templates/default/client/vite.config.js +7 -0
- package/templates/default/client/vite.config.js.map +1 -0
- package/templates/default/client/vite.config.ts +7 -0
- package/templates/default/server/README.md +1 -0
- package/templates/default/server/package-lock.json +2379 -0
- package/templates/default/server/package.json +28 -0
- package/templates/default/server/src/index.d.ts +2 -0
- package/templates/default/server/src/index.d.ts.map +1 -0
- package/templates/default/server/src/index.js +56 -0
- package/templates/default/server/src/index.js.map +1 -0
- package/templates/default/server/src/index.ts +66 -0
- package/templates/default/server/tsconfig.json +49 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-react-express-mongo",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc && vite build",
|
|
9
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
+
"preview": "vite preview"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@emotion/react": "^11.14.0",
|
|
14
|
+
"axios": "^1.16.1",
|
|
15
|
+
"react": "^18.2.0",
|
|
16
|
+
"react-dom": "^18.2.0",
|
|
17
|
+
"react-router-dom": "^7.14.2"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^25.9.1",
|
|
21
|
+
"@types/react": "^18.2.43",
|
|
22
|
+
"@types/react-dom": "^18.2.17",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
24
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
25
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
26
|
+
"eslint": "^8.55.0",
|
|
27
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
28
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
29
|
+
"typescript": "^5.2.2",
|
|
30
|
+
"vite": "^5.0.8"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" className="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["App.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAKlB,iBAAS,GAAG,4CAoBX;AAED,eAAe,GAAG,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './App.css';
|
|
3
|
+
import LandingPage from './components';
|
|
4
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
5
|
+
import { GetInitialContent } from './services/initialContent';
|
|
6
|
+
function App() {
|
|
7
|
+
const { loading, error, initialContent } = GetInitialContent();
|
|
8
|
+
if (loading) {
|
|
9
|
+
return _jsx("div", { children: "Loading initial content..." });
|
|
10
|
+
}
|
|
11
|
+
if (error) {
|
|
12
|
+
return _jsx("div", { children: "Unable to load initial content." });
|
|
13
|
+
}
|
|
14
|
+
return (_jsx(BrowserRouter, { children: _jsx("div", { className: "App", children: _jsx(Routes, { children: _jsx(Route, { path: "/", element: _jsx(LandingPage, { initialContentData: initialContent }) }) }) }) }));
|
|
15
|
+
}
|
|
16
|
+
export default App;
|
|
17
|
+
//# sourceMappingURL=App.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["App.tsx"],"names":[],"mappings":";AAAA,OAAO,WAAW,CAAA;AAClB,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,SAAS,GAAG;IACV,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAE/D,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,uDAAqC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,4DAA0C,CAAC;IACpD,CAAC;IAED,OAAO,CACL,KAAC,aAAa,cACZ,cAAK,SAAS,EAAC,KAAK,YAClB,KAAC,MAAM,cACL,KAAC,KAAK,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,KAAC,WAAW,IAAC,kBAAkB,EAAE,cAAc,GAAG,GAAI,GACxE,GACL,GACQ,CACjB,CAAC;AACJ,CAAC;AAED,eAAe,GAAG,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import './App.css'
|
|
2
|
+
import LandingPage from './components';
|
|
3
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
4
|
+
import { GetInitialContent } from './services/initialContent';
|
|
5
|
+
|
|
6
|
+
function App() {
|
|
7
|
+
const { loading, error, initialContent } = GetInitialContent();
|
|
8
|
+
|
|
9
|
+
if (loading) {
|
|
10
|
+
return <div>Loading initial content...</div>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (error) {
|
|
14
|
+
return <div>Unable to load initial content.</div>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<BrowserRouter>
|
|
19
|
+
<div className="App">
|
|
20
|
+
<Routes>
|
|
21
|
+
<Route path="/" element={<LandingPage initialContentData={initialContent}/>} />
|
|
22
|
+
</Routes>
|
|
23
|
+
</div>
|
|
24
|
+
</BrowserRouter>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default App
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,iBAAS,WAAW,CAAE,KAAK,EAAE,QAAQ,CAAC;IAAE,kBAAkB,EAAE,GAAG,CAAC;CAAE,CAAC,2CASlE;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
function LandingPage(props) {
|
|
3
|
+
const { initialContentData } = props;
|
|
4
|
+
return (_jsxs(_Fragment, { children: [_jsx("h1", { children: initialContentData.title }), _jsx("p", { children: initialContentData.description })] }));
|
|
5
|
+
}
|
|
6
|
+
export default LandingPage;
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAAA,SAAS,WAAW,CAAE,KAA6C;IAC/D,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAErC,OAAO,CACH,8BACI,uBAAK,kBAAkB,CAAC,KAAK,GAAM,EACnC,sBAAI,kBAAkB,CAAC,WAAW,GAAK,IACxC,CACN,CAAA;AACL,CAAC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function LandingPage (props: Readonly<{ initialContentData: any; }>) {
|
|
2
|
+
const { initialContentData } = props;
|
|
3
|
+
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<h1>{initialContentData.title}</h1>
|
|
7
|
+
<p>{initialContentData.description}</p>
|
|
8
|
+
</>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default LandingPage;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
line-height: 1.5;
|
|
3
|
+
font-weight: 400;
|
|
4
|
+
|
|
5
|
+
color-scheme: light dark;
|
|
6
|
+
font-synthesis: none;
|
|
7
|
+
text-rendering: optimizeLegibility;
|
|
8
|
+
-webkit-font-smoothing: antialiased;
|
|
9
|
+
-moz-osx-font-smoothing: grayscale;
|
|
10
|
+
-webkit-text-size-adjust: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
margin: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html {
|
|
18
|
+
scroll-behavior: smooth;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.tsx"],"names":[],"mappings":"AAGA,OAAO,aAAa,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom/client';
|
|
4
|
+
import App from './App';
|
|
5
|
+
import './index.css';
|
|
6
|
+
ReactDOM.createRoot(document.getElementById('root')).render(_jsx(React.StrictMode, { children: _jsx(App, {}) }));
|
|
7
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AACvC,OAAO,GAAG,MAAM,OAAO,CAAA;AACvB,OAAO,aAAa,CAAA;AAEpB,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAE,CAAC,CAAC,MAAM,CAC1D,KAAC,KAAK,CAAC,UAAU,cACf,KAAC,GAAG,KAAG,GACU,CACpB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialContent.d.ts","sourceRoot":"","sources":["initialContent.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB;;;;EA0BhC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
export function GetInitialContent() {
|
|
4
|
+
const [initialContent, setInitialContent] = useState({});
|
|
5
|
+
const [loading, setLoading] = useState(true);
|
|
6
|
+
const [error, setError] = useState(null);
|
|
7
|
+
const backendUrl = import.meta.env.VITE_BACKEND_URL || "http://localhost:3000";
|
|
8
|
+
let isApiProccessed = false;
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const fetchInitialContent = async () => {
|
|
11
|
+
try {
|
|
12
|
+
const response = await axios.get(`${backendUrl}/initial-content`);
|
|
13
|
+
setInitialContent(response.data);
|
|
14
|
+
}
|
|
15
|
+
catch (fetchError) {
|
|
16
|
+
setError(fetchError);
|
|
17
|
+
}
|
|
18
|
+
finally {
|
|
19
|
+
setLoading(false);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
// isApiProccessed is checking if Api ran one time it will not run it again. So, you can use this if your Api called two times on load
|
|
23
|
+
if (!isApiProccessed) {
|
|
24
|
+
isApiProccessed = true;
|
|
25
|
+
fetchInitialContent();
|
|
26
|
+
}
|
|
27
|
+
}, []);
|
|
28
|
+
return { initialContent, loading, error };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=initialContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialContent.js","sourceRoot":"","sources":["initialContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,iBAAiB;IAC/B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAsB,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC,CAAC;IAClD,MAAM,UAAU,GACX,MAAM,CAAC,IAAY,CAAC,GAAG,CAAC,gBAAgB,IAAI,uBAAuB,CAAC;IACzE,IAAI,eAAe,GAAG,KAAK,CAAC;IAE5B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,mBAAmB,GAAG,KAAK,IAAI,EAAE;YACrC,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAC9B,GAAG,UAAU,kBAAkB,CAChC,CAAC;gBACF,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,UAAU,EAAE,CAAC;gBACpB,QAAQ,CAAC,UAAU,CAAC,CAAC;YACvB,CAAC;oBAAS,CAAC;gBACT,UAAU,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;QACH,CAAC,CAAC;QACF,sIAAsI;QACtI,IAAG,CAAC,eAAe,EAAE,CAAC;YAAA,eAAe,GAAG,IAAI,CAAC;YAAC,mBAAmB,EAAE,CAAC;QAAA,CAAC;IACvE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
|
|
4
|
+
export function GetInitialContent() {
|
|
5
|
+
const [initialContent, setInitialContent] = useState<Record<string, any>>({});
|
|
6
|
+
const [loading, setLoading] = useState(true);
|
|
7
|
+
const [error, setError] = useState<unknown>(null);
|
|
8
|
+
const backendUrl =
|
|
9
|
+
(import.meta as any).env.VITE_BACKEND_URL || "http://localhost:3000";
|
|
10
|
+
let isApiProccessed = false;
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const fetchInitialContent = async () => {
|
|
14
|
+
try {
|
|
15
|
+
const response = await axios.get(
|
|
16
|
+
`${backendUrl}/initial-content`
|
|
17
|
+
);
|
|
18
|
+
setInitialContent(response.data);
|
|
19
|
+
} catch (fetchError) {
|
|
20
|
+
setError(fetchError);
|
|
21
|
+
} finally {
|
|
22
|
+
setLoading(false);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
// isApiProccessed is checking if Api ran one time it will not run it again. So, you can use this if your Api called two times on load
|
|
26
|
+
if(!isApiProccessed) {isApiProccessed = true; fetchInitialContent();}
|
|
27
|
+
}, []);
|
|
28
|
+
|
|
29
|
+
return { initialContent, loading, error };
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
/* Bundler mode */
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
/* Linting */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"noFallthroughCasesInSwitch": true,
|
|
20
|
+
"types": ["node"]
|
|
21
|
+
},
|
|
22
|
+
"include": ["src"],
|
|
23
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["vite.config.ts"],"names":[],"mappings":";AAIA,wBAEE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.config.js","sourceRoot":"","sources":["vite.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,MAAM,sBAAsB,CAAA;AAExC,6BAA6B;AAC7B,eAAe,YAAY,CAAC;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC;CACnB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# react-express-mongo server
|