-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): Added
api
to Website to get the latest and development v…
…ersion
- Loading branch information
1 parent
e3c492d
commit a706a3d
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {NextResponse} from "next/server"; | ||
|
||
export async function getDevelopmentVersion(){ | ||
let devVersionJson = (await fetch("https://raw.githubusercontent.com/SaptarshiSarkar12/Drifty/master/version.json", { | ||
next: {revalidate: 60} | ||
})).text(); | ||
return JSON.parse(await devVersionJson).version; | ||
} | ||
|
||
export async function GET() { | ||
let version = await getDevelopmentVersion(); | ||
return new NextResponse(version) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {NextResponse} from "next/server"; | ||
|
||
export async function getLatestVersion(){ | ||
let latestReleases = await fetch("https://api.github.com/repos/SaptarshiSarkar12/Drifty/releases/latest", { | ||
next: { revalidate: 60 } | ||
}).then((res) => res.json()); | ||
return latestReleases.tag_name.replace("v", ""); | ||
} | ||
|
||
export async function GET() { | ||
let version = await getLatestVersion(); | ||
return new NextResponse(version) | ||
} |
a706a3d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
drifty – ./
drifty-saptarshisarkar12.vercel.app
drifty-git-master-saptarshisarkar12.vercel.app
drifty.vercel.app