fix localhost
This commit is contained in:
@@ -6,6 +6,8 @@ import { Elysia } from "elysia";
|
|||||||
import api from "./api";
|
import api from "./api";
|
||||||
import { openInEditor } from "./utils/open-in-editor";
|
import { openInEditor } from "./utils/open-in-editor";
|
||||||
|
|
||||||
|
const PORT = process.env.PORT || 3000;
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === "production";
|
const isProduction = process.env.NODE_ENV === "production";
|
||||||
|
|
||||||
const app = new Elysia().use(api);
|
const app = new Elysia().use(api);
|
||||||
@@ -198,10 +200,10 @@ if (!isProduction) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
app.listen(3000);
|
app.listen(PORT);
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`🚀 Server running at http://localhost:3000 in ${isProduction ? "production" : "development"} mode`,
|
`🚀 Server running at http://localhost:${PORT} in ${isProduction ? "production" : "development"} mode`,
|
||||||
);
|
);
|
||||||
|
|
||||||
export type ApiApp = typeof app;
|
export type ApiApp = typeof app;
|
||||||
|
|||||||
@@ -2,11 +2,7 @@ import createClient from "openapi-fetch";
|
|||||||
import type { paths } from "../../generated/api";
|
import type { paths } from "../../generated/api";
|
||||||
import { VITE_PUBLIC_URL } from "./env";
|
import { VITE_PUBLIC_URL } from "./env";
|
||||||
|
|
||||||
const baseUrl =
|
const baseUrl = VITE_PUBLIC_URL;
|
||||||
VITE_PUBLIC_URL ||
|
|
||||||
(typeof window !== "undefined"
|
|
||||||
? window.location.origin
|
|
||||||
: "http://localhost:3000");
|
|
||||||
|
|
||||||
export const apiClient = createClient<paths>({
|
export const apiClient = createClient<paths>({
|
||||||
baseUrl: baseUrl,
|
baseUrl: baseUrl,
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ export const auth = betterAuth({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
secret: process.env.BETTER_AUTH_SECRET,
|
secret: process.env.BETTER_AUTH_SECRET,
|
||||||
trustedOrigins: ["http://localhost:5173", "http://localhost:3000"],
|
|
||||||
session: {
|
session: {
|
||||||
cookieCache: {
|
cookieCache: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user