feature: added base home 🏠 page

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2023-05-13 09:54:44 +05:30
parent 3e46cb4f92
commit f7fb3e2224
Signed by: bravo68web
GPG Key ID: F5671FD7BCB9917A
2 changed files with 15 additions and 1 deletions

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "My ShareX Server acting as Daddy",
"main": "index.ts",
"repository": "https://github.com/bravo68web/sx.git",
"repository": "https://github.com/bravo68web/shx.git",
"author": {
"email": "hi@b68.dev",
"name": "Jyotirmoy Bandyopadhayaya",

View File

@ -1,6 +1,9 @@
import path from 'path';
import { readdirSync } from 'fs';
import { fileURLToPath } from 'url';
import pkg from '../package.json' assert { type: 'json' };
import { execSync } from 'child_process';
const gitHash = execSync('git rev-parse HEAD').toString().trim();
const __filename = fileURLToPath(import.meta.url);
@ -37,4 +40,15 @@ let baseDir = path.dirname(__filename);
baseDir = path.resolve(baseDir);
loadRoutes(baseDir);
router.get('/', (req, res) => {
return res.status(200).json({
message: 'Welcome to the SHX API!',
status: 'OK',
version: pkg.version,
source_code: pkg.repository,
git_commit_id: gitHash,
});
});
export default router;