Skip to content

Commit

Permalink
Restructure to single deploy (#26)
Browse files Browse the repository at this point in the history
* Begin restructure process

Use root src as client code, server as the API
public as the bundled React App that is then delivered by ExpressJS

* Add auth middleware and move image module to services folder

* Add DB initialization for roles and default admin user

* Add auth routes to server with signin path

* Update login to return role name

* Add authorization middleware for admin and editor

* Add admin routes to create users

* Add put and delete routes to API. Remove old server code

* Add webpack scripts and get client rendering

* Render itemGrid and update to React createRoot

* Update readme and set proper watch script

* Initial updates to re-implement login logout functionality

* Move login dialog and navbar clicks to app

* Style the login dialog

* Use arrow functions and remove login dialog references where no longer needed

* Re-implement Add/Edit dialog

* Remove edit dialog from navbar and use props for logout

* Raise manage mode to App to pass as props below

* Update itemCard to component class and pass manageMode down

* Add new dialog to separate add and edit

It was getting confusing and difficult to manage various forms of state
in a single dialog. Created a new Add dialog to handle creating items only.
Cleaned up some commented code and unused imports.

* Add trigger prop to App to reload items on add. Reload items on edit

* Add error handling in App with alert snackbar

* Re-implement edit call in UI

* Add refresh function to disable cache control. Pass item errors up

* Remove dotenv and use only as dev dependency

* Add nodemon dev dependency to watch server as well

* Add DISABLE_AUTH env var to skip auth for anonymous access

* Add functionality to disable auth

* Remove unused code and console log

* Remove front-end from compose and expose port
  • Loading branch information
burtonr authored Jul 10, 2022
1 parent ffff81c commit 1de6e0a
Show file tree
Hide file tree
Showing 62 changed files with 15,670 additions and 42,902 deletions.
File renamed without changes.
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PORT=4040
MONGO_URI="mongodb://mongo:secretPassword@mongo"
API_KEY="something-secret"
25 changes: 5 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
# dependencies
**/*/node_modules
/node_modules
/.pnp
.pnp.js

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Client
client/src/config/*.json
!client/src/config/default.json
!client/src/config/docker.json

# testing
client/coverage

# production
client/build

# Server
server/src/config/*.json
!server/src/config/default.json
!server/src/config/docker.json
# compiled
public/*.js
public/*.txt
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# FROM node:16-alpine as build
# WORKDIR /app

# COPY package*.json ./
# COPY public/ ./public/

# RUN npm ci --silent
# RUN npm install react-scripts@4.0.3 -g --silent

# COPY src/ ./src/

# RUN npm run build

# FROM nginx:stable-alpine
# RUN apk add --no-cache jq

# COPY --from=build /app/build /usr/share/nginx/html
# EXPOSE 80

# COPY docker-entrypoint.sh /
# ENTRYPOINT ["/docker-entrypoint.sh"]
# CMD ["nginx", "-g", "daemon off;"]

# FROM node:16-alpine
# WORKDIR /server

# ENV NODE_ENV=docker

# RUN chown node:node /server
# USER node

# COPY --chown=node:node src/package*.json ./

# RUN npm install

# COPY --chown=node:node src/ ./

# CMD ["node", "server.js"]
6 changes: 6 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
1 change: 0 additions & 1 deletion client/.env

This file was deleted.

22 changes: 0 additions & 22 deletions client/Dockerfile

This file was deleted.

74 changes: 0 additions & 74 deletions client/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions client/docker-entrypoint.sh

This file was deleted.

Loading

0 comments on commit 1de6e0a

Please sign in to comment.