36 lines
746 B
JavaScript
36 lines
746 B
JavaScript
'use strict';
|
|
|
|
const express = require('express');
|
|
const glob = require('glob');
|
|
const path = require('path');
|
|
|
|
const modulesDir = path.resolve(__dirname + '/../modules/')
|
|
const globOptions = {
|
|
cwd: modulesDir,
|
|
nocase: true,
|
|
nodir: true,
|
|
absolute: true,
|
|
}
|
|
|
|
module.exports = function () {
|
|
const router = express.Router({ mergeParams: true });
|
|
|
|
router.get('/_health', (req, res, next) => {
|
|
res.json({
|
|
code: 200,
|
|
message: 'success',
|
|
description: 'Welcome, this is the API for the application.'
|
|
});
|
|
});
|
|
|
|
glob.sync("**/*.routes.js", globOptions)
|
|
.forEach(function (file) {
|
|
router.use('/v2', require(file));
|
|
});
|
|
|
|
return router;
|
|
}
|
|
|
|
|
|
|