Archived
2
This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
definma-api/src/routes/root.ts

16 lines
389 B
TypeScript
Raw Normal View History

2020-01-14 13:25:13 +01:00
import express from 'express';
2020-04-23 13:59:45 +02:00
import globals from '../globals';
2020-01-14 13:25:13 +01:00
const router = express.Router();
router.get('/', (req, res) => {
2020-04-22 17:38:24 +02:00
res.json({status: 'API server up and running!'});
2020-01-14 13:25:13 +01:00
});
2020-04-23 13:59:45 +02:00
router.get('/authorized', (req, res) => {
if (!req.auth(res, globals.levels)) return;
res.json({status: 'Authorization successful', method: req.authDetails.method});
});
2020-01-14 13:25:13 +01:00
module.exports = router;