Create base structure
This commit is contained in:
parent
8d97415c4e
commit
bd0a88c7dc
|
@ -0,0 +1 @@
|
||||||
|
node_modules/
|
|
@ -0,0 +1,10 @@
|
||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
|
app.use(express.json());
|
||||||
|
const convert = require('./util/convert');
|
||||||
|
|
||||||
|
app.get('/webhook/:provider', (req) => {
|
||||||
|
const strategy = req.params.provider;
|
||||||
|
const eventType = convert.getEvent[strategy](req.body);
|
||||||
|
});
|
||||||
|
app.listen(2000, () => console.log('Listening on port 2000'));
|
|
@ -0,0 +1,6 @@
|
||||||
|
const github = function (body) {
|
||||||
|
};
|
||||||
|
|
||||||
|
const gitlab = github;
|
||||||
|
|
||||||
|
module.exports = { github, gitlab };
|
|
@ -0,0 +1,6 @@
|
||||||
|
const github = function (body) {
|
||||||
|
if (body.commits && body.ref.match("^/refs/heads/") return "commit";
|
||||||
|
if (body.commits && body.ref.match("^/refs/tags/") return "tag";
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {github};
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = {
|
||||||
|
getEvent: require('./event'),
|
||||||
|
commit: require('./commit'),
|
||||||
|
};
|
Loading…
Reference in New Issue