Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
jochen eab35c5f9f Don't show home layout when instance is not defined vor 1 Jahr
admin-client Added multiple home layouts vor 1 Jahr
client Don't show home layout when instance is not defined vor 1 Jahr
server Added multiple home layouts vor 1 Jahr
.drone.yml Initial commit vor 1 Jahr
.gitignore Initial commit vor 1 Jahr
README.md Initial commit vor 1 Jahr
package-lock.json Initial commit vor 1 Jahr
package.json Initial commit vor 1 Jahr

README.md

Novox Photos manager

Client - Photos react app

App structure

  • React application with a public facing website (./public) and an administration panel (./private)
  • React router is split into <PublicRoutes /> and <PrivateRoutes />
  • <PrivateRoutes /> is wrapped in the <Keycloak> context provider
  • The <Keyclock> context provider is created using the AuthProvider from the oidc-react package
  • AutoSignin is explicitly set to false to prevent the website from always trying to log in (even if not trying to access the admin section)
  • The <AdminLayout> component handles the authentication only rendering the <Outlet> when the user is logged in and has sufficient permissions (role based)
  • We can access the user info using the useAuth hook, only possible in React components or hooks
  • Our privateApi service is provided using the usePrivateApi hook, it makes use of the useAuth hook to set the authorization header
  • The url for the private api is set using a “environment variable” (see build process)

Build process

  • The build process is quite simple and uses react-scripts build
  • “Environment variables” can be set in the .env file. Before starting the application run ./scripts/env.sh to create an env-config.js file in the./public folder which is then loaded using a <script> tag in index.html
  • In our docker setup, we can pass the environment variables in our docker-compose. When starting the container the env.sh script is executed before starting the application

Server - Photos node api

App structure

  • We use Koa to setup our web api
  • Our api is split into a /api/public and /api/private routes (see the 2 routers)
  • Router and HttpEndpoint types can be used to add new endpoints
  • Following middleware is provided:
    • JWT token validation
    • Request/response logging
    • CORS
    • Error handling
    • @koa/multer to handle file uploads using multipart/form-data