├── client
├── index.css
├── index.js
└── App.jsx
├── .gitignore
├── README.md
├── index.html
├── webpack.config.js
├── server
└── server.js
└── package.json
/client/index.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .env
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # bivouac
2 | Your go to mobile hike tracking application
3 | ...read the code XD
4 |
--------------------------------------------------------------------------------
/client/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css'
4 | import App from './App.jsx';
5 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 |
8 | root.render(
9 |
10 | );
11 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | bivouac app
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/client/App.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
3 | // import Home from "./src/pages/Home";
4 | // import Login from "./src/pages/Login";
5 | // import Register from "./src/pages/Register";
6 |
7 | const App = () => {
8 |
9 | return (
10 |
11 |
HEY
12 | {/*
13 | */}
14 | {/* } />
15 | } />
16 | } /> */}
17 | {/*
18 | */}
19 |
20 | );
21 | }
22 |
23 | // export function ProtectedRoute(props){
24 |
25 | // if(localStorage.getItem('user'))
26 | // {
27 | // return props.children
28 |
29 | // } else {
30 |
31 | // return
32 | // }
33 |
34 | // }
35 |
36 | export default App;
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const HtmlWebpackPlugin = require('html-webpack-plugin');
3 |
4 | module.exports = {
5 | mode: process.env.NODE_ENV,
6 | entry: path.join(__dirname, './client/index.js'),
7 | output: {
8 | path: path.resolve(__dirname, 'dist'),
9 | publicPath: '/',
10 | filename: 'bundle.js'
11 | },
12 | resolve: {
13 | extensions: [".js", ".jsx"],
14 | },
15 | module: {
16 | rules: [
17 | {
18 | test: /\.jsx?/,
19 | exclude: /node_modules/,
20 | use: {
21 | loader: 'babel-loader',
22 | options: {
23 | presets: ['@babel/preset-env', '@babel/preset-react']
24 | }
25 | }
26 | },
27 | {
28 | test: /\.s[ac]ss$/i,
29 | use: [ "style-loader", "css-loader", "sass-loader" ],
30 | },
31 | {
32 | test: /\.(png|jpe?g|gif)$/i,
33 | use: [
34 | {
35 | loader: 'file-loader',
36 | },
37 | ],
38 | }
39 | ]
40 | },
41 | plugins: [
42 | new HtmlWebpackPlugin({
43 | title: 'Development',
44 | template: './index.html'
45 | })
46 | ],
47 | devServer: {
48 | port: 8081,
49 | hot: true,
50 | static: {
51 | publicPath: '/dist',
52 | directory: path.resolve(__dirname, 'dist')
53 | },
54 | proxy: {
55 | '/api': 'http://localhost:3000'
56 | }
57 | }
58 | };
59 |
--------------------------------------------------------------------------------
/server/server.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const app = express();
4 | const PORT = 3000;
5 |
6 | app.use(express.json());
7 | app.use(express.urlencoded({ extended: true }));
8 |
9 |
10 | if (process.env.NODE_ENV === 'production') {
11 | app.use('/dist', express.static(path.resolve(__dirname, '../dist')));
12 |
13 | app.get('/', (req, res) => {
14 | return res.status(200).sendFile(path.resolve(__dirname, '../index.html'));
15 | });
16 | };
17 |
18 |
19 | // app.use((req, res) => res.sendStatus(404)); // catch-all route handler for any requests to an unknown route
20 | app.get('*', (req, res) => {
21 | console.log("Invalid URL detected");
22 | res.status(404).json({ error: `Page not found, request to ${req.path} failed` });
23 | });
24 |
25 |
26 | /**
27 | * configure express global error handler
28 | * @see https://expressjs.com/en/guide/error-handling.html#writing-error-handlers
29 | */
30 | app.use((err, req, res, next) => {
31 | const defaultErr = {
32 | log: 'Express error handler caught unknown middleware error',
33 | status: 500,
34 | message: { err: 'An error occurred: ' + err },
35 | };
36 |
37 | const errorObj = Object.assign({}, defaultErr, err);
38 | console.log(errorObj.message);
39 |
40 | return res.send({'Error status': errorObj.status, 'Message': errorObj.message});
41 | // return res.status(errorObj.status).json(errorObj.message)
42 | });
43 |
44 |
45 | app.listen(PORT, () => {
46 | console.log(`Server listening on port: ${PORT}`);
47 | });
48 |
49 | module.exports = app;
50 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bivouac",
3 | "version": "1.0.0",
4 | "description": "Your go to mobile hike tracking application",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "NODE_ENV=production nodemon server/server.js --open",
8 | "build": "webpack",
9 | "dev": "NODE_ENV=development nodemon server/server.js & NODE_ENV=development webpack serve"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/team-axolotl1/bivouac.git"
14 | },
15 | "keywords": [],
16 | "author": "",
17 | "license": "ISC",
18 | "bugs": {
19 | "url": "https://github.com/team-axolotl1/bivouac/issues"
20 | },
21 | "homepage": "https://github.com/team-axolotl1/bivouac#readme",
22 | "dependencies": {
23 | "@reduxjs/toolkit": "^1.8.3",
24 | "axios": "^0.27.2",
25 | "dotenv": "^16.0.1",
26 | "express": "^4.18.1",
27 | "mongodb": "^4.8.0",
28 | "mongoose": "^6.4.4",
29 | "nodemon": "^2.0.19",
30 | "react": "^18.2.0",
31 | "react-dom": "^18.2.0",
32 | "react-redux": "^8.0.2",
33 | "react-router-dom": "^6.3.0",
34 | "tailwindcss": "^3.1.6"
35 | },
36 | "devDependencies": {
37 | "@babel/core": "^7.18.6",
38 | "@babel/preset-env": "^7.18.6",
39 | "@babel/preset-react": "^7.18.6",
40 | "babel-loader": "^8.2.5",
41 | "css-loader": "^6.7.1",
42 | "file-loader": "^6.2.0",
43 | "html-webpack-plugin": "^5.5.0",
44 | "sass-loader": "^13.0.2",
45 | "style-loader": "^3.3.1",
46 | "webpack": "^5.73.0",
47 | "webpack-cli": "^4.10.0",
48 | "webpack-dev-server": "^4.9.3"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------