UNPKG

overwatch-api-server

Version:
39 lines (34 loc) 906 B
const express = require('express'); const router = express.Router(); import { name, description, version, bugs, homepage } from '../../package.json'; /** * @api {get} / Get API status. * @apiName GetAPI * @apiGroup API * * @apiExample {curl} Example usage: * curl -i https://owapi.io/ * * @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { name: "overwatch-api", description: "Overwatch API", version: "0.0.1", homepage: "https://github.com/alfg/overwatch-api", bugs: "https://github.com/alfg/overwatch-api/issues", docs: "https://owapi.io/docs" } */ router.get('/', (req, res) => { const json = { name, description, version, homepage, bugs: bugs.url, docs: `${req.protocol}://${req.get('host')}${req.originalUrl}docs` }; res.json(json); }); export default router;