Skip to content

Commit

Permalink
remove base path from ui build, but keep for api (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
leigh-johnson authored Nov 6, 2022
1 parent d487df8 commit 74f5577
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use static_files::NpmBuild;

fn main() -> std::io::Result<()> {
NpmBuild::new("./ui")
.change_detection()
.install()
.expect("Failed to run npm install")
.run("build")
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async fn main() -> Result<()> {
let generated = generate();
App::new()
.service(get_version_data::get_version_data)
.service(ResourceFiles::new("/printnanny/ui/*", generated).resolve_not_found_to_root())
.service(ResourceFiles::new("/*", generated))
})
.workers(config.workers)
.bind((config.host, config.port))?
Expand Down
3 changes: 0 additions & 3 deletions ui/.env/.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
VITE_PRINTNANNY_EDGE_API_URL = "http://localhost:8080"
VITE_PRINTNANNY_CLOUD_API_URL = "https://printnanny.ai"

VITE_PRINTNANNY_EDGE_NATS_WS_PORT = "8844"
VITE_PRINTNANNY_EDGE_JANUS_WS_PORT = "8188"
VITE_POSTHOG_CLIENT_KEY = "phc_if1FbWP98XhFJMRt9ISTp1NvOe9MExeTNG9pH05c50P"
VITE_POSTHOG_API_URL = "https://app.posthog.com"

VITE_BASE_URL=/printnanny/ui/
VITE_BASE_UI_URL=/printnanny/ui/
VITE_BASE_API_URL=/printnanny/api/
4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "0.1.0",
"browser": "main.ts",
"scripts": {
"dev": "vite --mode dev --base=/printnanny/ui/",
"dev": "vite --mode dev",
"build": "run-p type-check build-only",
"preview": "vite preview --port 4173",
"test:unit": "vitest --environment jsdom",
"test:e2e": "start-server-and-test preview http://localhost:4173/ 'cypress open --e2e'",
"test:e2e:ci": "start-server-and-test preview http://localhost:4173/ 'cypress run --e2e'",
"build-only": "vite build --base=/printnanny/ui/",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"lint:fix": "eslint . --fix --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
Expand Down
2 changes: 1 addition & 1 deletion ui/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useCloudStore } from "@/stores/cloud";
import { AllRoutes } from "./routes";

const router = createRouter({
history: createWebHistory(import.meta.env.VITE_BASE_UI_URL),
history: createWebHistory('/'),
routes: AllRoutes,
});

Expand Down

0 comments on commit 74f5577

Please sign in to comment.