Skip to content

Instantly share code, notes, and snippets.

@infomiho
Created June 18, 2025 08:32
Show Gist options
  • Save infomiho/e98e524d252abbc53e558f957e04b689 to your computer and use it in GitHub Desktop.
Save infomiho/e98e524d252abbc53e558f957e04b689 to your computer and use it in GitHub Desktop.
Wasp setting server URL dynamically
app axiosTest {
wasp: {
version: "^0.16.0"
},
title: "axios-test",
auth: {
userEntity: User,
methods: {
usernameAndPassword: {}, // This is a very naive implementation, use 'email' in production instead
//google: {}, // https://wasp.sh/docs/integrations/google
//gitHub: {}, // https://wasp.sh/docs/integrations/github
//email: {} // https://wasp.sh/docs/guides/email-auth
},
onAuthFailedRedirectTo: "/login",
},
client: {
setupFn: import { setUpClient } from "@src/clientSetup",
}
}
import { api } from "wasp/client/api";
export function setUpClient() {
if (window.location.hostname !== "localhost") {
api.defaults.baseURL = "http://someother.com";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment