mirror of
https://github.com/Ravinou/borgwarehouse
synced 2024-05-29 03:52:48 +02:00
feat: new API endpoint to check the version number
This commit is contained in:
parent
2b5526ab7c
commit
962ef6f634
16
pages/api/version/index.js
Normal file
16
pages/api/version/index.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import packageInfo from '../../../package.json';
|
||||
|
||||
export default async function handler(req, res) {
|
||||
if (req.method === 'GET') {
|
||||
try {
|
||||
res.status(200).json({ version: packageInfo.version });
|
||||
return;
|
||||
} catch (error) {
|
||||
res.status(500).json({
|
||||
status: 500,
|
||||
message: 'API error, contact the administrator !',
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue