Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
120 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var express = require('express') | ||
, bodyParser = require('body-parser'); | ||
var app = express(); | ||
var sqlite3 = require('sqlite3').verbose(); | ||
var db = new sqlite3.Database('/var/www/html/apps/radiogit/db.sqlite'); | ||
|
||
|
||
app.get('/', function (req, res) { | ||
res.send('RadioGit backend is up and running') | ||
}) | ||
|
||
app.use(bodyParser.json()); | ||
app.post('/test', function(request, response){ | ||
var text = request.body.repository.full_name + " - " + request.body.commits[0].author.username + " committed " + request.body.commits[0].message + " " + " " + request.body.commits[0].url; | ||
var query = 'INSERT INTO Payloads VALUES (NULL, "' + request.body.repository.full_name + '","' + text + '")'; | ||
response.send("Thank you kind sir"); | ||
db.serialize(function() { | ||
db.run(query); | ||
console.log(query); | ||
}); | ||
|
||
|
||
}); | ||
|
||
app.listen(3000); | ||
|
||
// On CTRL+C correctly close the database | ||
process.on('SIGINT', function(){ | ||
console.log('Cya'); | ||
db.close(); | ||
process.exit(0); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "radiogit-weblistener", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "index.js", | ||
"dependencies": { | ||
"body-parser": "^1.17.1", | ||
"ejs": "^2.5.6", | ||
"express": "^4.15.2" | ||
}, | ||
"devDependencies": {}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Antonio Vivace", | ||
"license": "GPL-3.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var express = require('express') | ||
, bodyParser = require('body-parser'); | ||
var app = express(); | ||
var sqlite3 = require('sqlite3').verbose(); | ||
var db = new sqlite3.Database('/var/www/html/apps/radiogit/db.sqlite'); | ||
|
||
app.get('/', function (req, res) { | ||
res.send('RadioGit backend is up and running') | ||
}) | ||
|
||
app.use(bodyParser.json()); | ||
app.post('/test', function(request, response){ | ||
//console.log(request.body); | ||
var text = request.body.repository.full_name + " - " + request.body.commits[0].author.username + " committed " + request.body.commits[0].message + " " + " " + request.body.commits[0].url; | ||
var query = 'INSERT INTO Payloads VALUES (NULL, "' + request.body.repository.full_name + '","' + text + '")'; | ||
response.send("Thank you kind sir"); | ||
db.serialize(function() { | ||
db.run(query); | ||
console.log(query); | ||
}); | ||
|
||
|
||
}); | ||
|
||
app.listen(3000); | ||
|
||
process.on('SIGINT', function(){ | ||
console.log('Cya'); | ||
db.close(); | ||
process.exit(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "radiogit-weblistener", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "index.js", | ||
"dependencies": { | ||
"body-parser": "^1.17.1", | ||
"ejs": "^2.5.6", | ||
"express": "^4.15.2" | ||
}, | ||
"devDependencies": {}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Antonio Vivace", | ||
"license": "GPL-3.0" | ||
} |