summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/.env1
-rw-r--r--client/.env.development1
-rw-r--r--client/.env.production1
-rw-r--r--client/.env.test1
-rw-r--r--client/README.md30
-rw-r--r--client/package.json12
-rw-r--r--client/tsconfig.json3
-rw-r--r--client/vitest.config.ts (renamed from client/vite.config.ts)4
-rw-r--r--server/admin/handler.go2
-rw-r--r--server/cmd/main.go4
-rw-r--r--server/guest/handler.go6
11 files changed, 13 insertions, 52 deletions
diff --git a/client/.env b/client/.env
deleted file mode 100644
index 2f560b8..0000000
--- a/client/.env
+++ /dev/null
@@ -1 +0,0 @@
-VITE_BASE_URL=http://192.168.1.18:8080/
diff --git a/client/.env.development b/client/.env.development
new file mode 100644
index 0000000..be2cee9
--- /dev/null
+++ b/client/.env.development
@@ -0,0 +1 @@
+VITE_BASE_URL=http://192.168.1.18:8080/api/
diff --git a/client/.env.production b/client/.env.production
new file mode 100644
index 0000000..7e27439
--- /dev/null
+++ b/client/.env.production
@@ -0,0 +1 @@
+VITE_BASE_URL=https://localhost:8080/api/
diff --git a/client/.env.test b/client/.env.test
new file mode 100644
index 0000000..be2cee9
--- /dev/null
+++ b/client/.env.test
@@ -0,0 +1 @@
+VITE_BASE_URL=http://192.168.1.18:8080/api/
diff --git a/client/README.md b/client/README.md
deleted file mode 100644
index 0d6babe..0000000
--- a/client/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# React + TypeScript + Vite
-
-This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
-
-Currently, two official plugins are available:
-
-- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
-- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
-
-## Expanding the ESLint configuration
-
-If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
-
-- Configure the top-level `parserOptions` property like this:
-
-```js
-export default {
- // other rules...
- parserOptions: {
- ecmaVersion: 'latest',
- sourceType: 'module',
- project: ['./tsconfig.json', './tsconfig.node.json'],
- tsconfigRootDir: __dirname,
- },
-}
-```
-
-- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
-- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
-- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
diff --git a/client/package.json b/client/package.json
index 0990aa3..eda5a5b 100644
--- a/client/package.json
+++ b/client/package.json
@@ -13,14 +13,11 @@
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
- "@fontsource/roboto": "^5.0.14",
"@mui/icons-material": "^5.16.7",
- "@mui/lab": "^5.0.0-alpha.165",
"@mui/material": "^5.16.7",
"@mui/x-date-pickers": "^7.14.0",
"@reduxjs/toolkit": "^2.2.1",
"material-react-table": "^2.13.1",
- "prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.50.1",
@@ -28,23 +25,18 @@
"react-router-dom": "^6.22.0"
},
"devDependencies": {
- "@hookform/devtools": "^4.3.1",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
- "@types/bun": "^1.1.0",
- "@types/react": "^18.2.55",
- "@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
- "@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"jsdom": "^25.0.0",
"msw": "^2.2.1",
- "typescript": "^5.2.2",
- "vite": "^5.4.2",
+ "typescript": "^5.6.2",
+ "vite": "^5.4.8",
"vitest": "^2.1.1"
}
}
diff --git a/client/tsconfig.json b/client/tsconfig.json
index 4c214ba..0b04524 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -7,7 +7,6 @@
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
- "types": ["vite/client"],
// Bundler mode
"moduleResolution": "bundler",
@@ -25,5 +24,5 @@
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true
},
- "include": ["vite-env.d.ts", "vite.config.ts"]
+ "include": ["vite-env.d.ts", "vitest.config.ts"]
}
diff --git a/client/vite.config.ts b/client/vitest.config.ts
index 2942029..2de257c 100644
--- a/client/vite.config.ts
+++ b/client/vitest.config.ts
@@ -1,10 +1,8 @@
/// <reference types="vitest" />
-import { defineConfig } from 'vite';
-import react from '@vitejs/plugin-react';
+import { defineConfig } from 'vitest/config';
// https://vitejs.dev/config/
export default defineConfig({
- plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
diff --git a/server/admin/handler.go b/server/admin/handler.go
index fa2dfb4..0aa9659 100644
--- a/server/admin/handler.go
+++ b/server/admin/handler.go
@@ -34,7 +34,7 @@ func (adminHandler *AdminHandler) ServeHTTP(responseWriter http.ResponseWriter,
switch {
case request.Method == http.MethodOptions:
responseWriter.WriteHeader(http.StatusOK)
- case request.Method == http.MethodPost && request.URL.Path == "/admin/login":
+ case request.Method == http.MethodPost && request.URL.Path == "/api/admin/login":
adminHandler.handleLogIn(responseWriter, request)
default:
responseWriter.WriteHeader(http.StatusNotFound)
diff --git a/server/cmd/main.go b/server/cmd/main.go
index 21cdccc..a180cc4 100644
--- a/server/cmd/main.go
+++ b/server/cmd/main.go
@@ -36,8 +36,8 @@ func main() {
adminHandler := admin.NewAdminHandler(adminStore, guestStore)
mux := http.NewServeMux()
- mux.Handle("/guests/", guestHandler)
- mux.Handle("/admin/", adminHandler)
+ mux.Handle("/api/guests/", guestHandler)
+ mux.Handle("/api/admin/", adminHandler)
log.Fatal(http.ListenAndServe(":8080", serveHTTP(mux)))
}
diff --git a/server/guest/handler.go b/server/guest/handler.go
index 008aeef..20ed2dc 100644
--- a/server/guest/handler.go
+++ b/server/guest/handler.go
@@ -13,8 +13,8 @@ import (
)
var (
- guestRegex = regexp.MustCompile(`^/guests/*$`)
- guestIDRegex = regexp.MustCompile(`^/guests/([0-9]+)$`)
+ guestRegex = regexp.MustCompile(`^/api/guests/*$`)
+ guestIDRegex = regexp.MustCompile(`^/api/guests/([0-9]+)$`)
)
type GuestHandler struct {
@@ -46,7 +46,7 @@ func (handler *GuestHandler) ServeHTTP(responseWriter http.ResponseWriter,
switch {
case request.Method == http.MethodOptions:
responseWriter.WriteHeader(http.StatusOK)
- case request.Method == http.MethodPost && request.URL.Path == "/guests/login":
+ case request.Method == http.MethodPost && request.URL.Path == "/api/guests/login":
handler.handleLogIn(responseWriter, request)
case request.Method == http.MethodPut && guestIDRegex.MatchString(request.URL.Path):
handler.handlePut(responseWriter, request)