fix: remove reduce/ from request URI

This commit is contained in:
Arkaprabha Chakraborty
2025-03-14 21:07:56 +05:30
parent 352dd9b7fd
commit d8bf101527
3 changed files with 4 additions and 4 deletions

View File

@@ -147,8 +147,8 @@ func main() {
return c.String(http.StatusOK, "Backend is running alright.\n")
})
e.POST("/reduce/shorten", shortenURL)
e.GET("/reduce/:id", fetchLongURL)
e.POST("/shorten", shortenURL)
e.GET("/:id", fetchLongURL)
e.Logger.Fatal(e.Start(":8080"))
}

View File

@@ -9,7 +9,7 @@ export async function GET(request, { params }) {
try {
const response = await axios.get(
`${process.env.NEXT_PUBLIC_BACKEND_URL}/reduce/${id}`
`${process.env.NEXT_PUBLIC_BACKEND_URL}/${id}`
);
if (response.status === 200) {
return NextResponse.redirect(response.data.long_url);

View File

@@ -22,7 +22,7 @@ export default function Home() {
const baseURL = window.location.origin;
try {
const response = await axios.post(
`${process.env.NEXT_PUBLIC_BACKEND_URL}/reduce/shorten`,
`${process.env.NEXT_PUBLIC_BACKEND_URL}/shorten`,
{
long_url: longUrl,
base_url: baseURL,