mirror of
https://github.com/theoleuthardt/werkzeugkiste.git
synced 2026-06-13 09:37:53 +00:00
fix: all pages now use the right backend url + backend uses .env of root too
This commit is contained in:
parent
0d92719258
commit
607d496f2a
11 changed files with 22 additions and 14 deletions
|
|
@ -10,6 +10,10 @@ import { generateQRCode } from "./src/routes/generateqrcode.route";
|
||||||
import { wordCounter } from "./src/routes/wordcounter.route";
|
import { wordCounter } from "./src/routes/wordcounter.route";
|
||||||
import { videoToAudio } from "./src/routes/videotoaudio.route";
|
import { videoToAudio } from "./src/routes/videotoaudio.route";
|
||||||
import { removeBG } from "./src/routes/removebg.route";
|
import { removeBG } from "./src/routes/removebg.route";
|
||||||
|
import dotenv from "dotenv";
|
||||||
|
import path from "node:path";
|
||||||
|
|
||||||
|
dotenv.config({ path: path.resolve(__dirname, "../.env") });
|
||||||
|
|
||||||
const app = Fastify({ logger: true });
|
const app = Fastify({ logger: true });
|
||||||
|
|
||||||
|
|
@ -30,7 +34,8 @@ app.register(wordCounter);
|
||||||
app.register(videoToAudio);
|
app.register(videoToAudio);
|
||||||
app.register(removeBG);
|
app.register(removeBG);
|
||||||
|
|
||||||
const PORT = process.env.PORT || 4000;
|
console.log("Starting Fastify server...");
|
||||||
|
const PORT = process.env.BACKEND_PORT;
|
||||||
app.listen({ port: Number(PORT), host: "0.0.0.0" }, () => {
|
app.listen({ port: Number(PORT), host: "0.0.0.0" }, () => {
|
||||||
console.log(`🚀Fastify is live on http://localhost:${PORT}`);
|
console.log(`🚀Fastify is live on http://localhost:${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ dotenv.config({ path: "../.env" });
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
env: {
|
env: {
|
||||||
backend_url: process.env.NEXT_PUBLIC_BACKEND_URL,
|
NEXT_PUBLIC_BACKEND_URL: process.env.NEXT_PUBLIC_BACKEND_URL,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,13 @@ export default function BGRemover() {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(process.env.backend_url + "/api/remove-bg", {
|
const response = await fetch(
|
||||||
method: "POST",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/remove-bg",
|
||||||
body: formData,
|
{
|
||||||
});
|
method: "POST",
|
||||||
|
body: formData,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error(`Error: ${response.statusText}`);
|
console.error(`Error: ${response.statusText}`);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export default function DocConverter() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
process.env.backend_url + "/api/libre-convert",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/libre-convert",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export default function PasswordGenerator() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
process.env.backend_url + "/api/password-generate",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/password-generate",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export default function QrCodeGenerator() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
process.env.backend_url + "/api/generate-qrcode",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/generate-qrcode",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export default function RegexTester() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
process.env.backend_url + "/api/regex-test",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/regex-test",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export default function RgbToHex() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
process.env.backend_url + "/api/color-convert",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/color-convert",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export default function TMZConverter() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
process.env.backend_url + "/api/tmz-convert",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/tmz-convert",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export default function DocConverter() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
process.env.backend_url + "/api/video-to-audio",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/video-to-audio",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export default function WordCounter() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
process.env.backend_url + "/api/word-counter",
|
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/word-counter",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue