Skip to content

Commit

Permalink
Clean up & some internals (#6)
Browse files Browse the repository at this point in the history
* Update Travis CI configuration (#5)

* Fix YML indentation

* Add webhook notification on failure

* Infra for generating API documentation

* HTTP API doc generation

* Linting

* Expand travis config
  • Loading branch information
niekcandaele authored Mar 21, 2019
1 parent daec285 commit 6665648
Show file tree
Hide file tree
Showing 12 changed files with 778 additions and 157 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ typings/

# next.js build output
.next

docs/
38 changes: 34 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,39 @@ services:
before_install:
- mysql -e 'CREATE DATABASE gbl_development;'
install:
- npm install
- npm install
script:
- npm run lint
- npm run db:init
- npm test
- npm run lint
- npm run db:init
- npm test

after_success:
- npm pack
- npm run docs:api

after_failure:
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- "./send.sh failure $WEBHOOK_URL"

deploy:
- provider: releases
api_key:
secure: Ap+NxH5ncMku3xn9U5vmgMLlsSv4Njp0nFyAuKVH8Vr7YAQWb9VsNceH3XyOebaNZaU8mPZyorXCznH/T0rUMf/5VIVc4mQ+NtdXczNORLa3Mro0Z5XQdAW5y3Z3x6amg8V2n8OQolkO5cwm1lxiIVAKlbH+tekhpgExIm5mF7kqjwMDVuRyFkKrEMaNgzB3cDfSPP4YAh3Wl6Kbs9kZZZKn2zcPQU2fAT5wUV/4qdLwfE5qrJAeSEUHh6v5Ro8AF0zcu2XvdPK+ykMDSirtOVHGejJZWrRRvXw69EVuNdHGBWPdg8B3sujw0G6m9J9liyFbV/C1B1DtQ/1kIJn2cjZ9VpZjkjk9FyVFxs/YGx7O1lTCiVFMOEfNudKpe7XFqu11z2FVsc2GqTbiblgUs4F6YpwiLQuHefg+xav12Ikz98fAVZj3s15tEr/21smGp5s2m2IsuiPikOmZ591c9TTPV9KO6mNTM0AwyK7ZoDC6t2MqMkSCO+7Oe0FBG5bYq6O4Vauc8iEf4FCS1qHhQkndolO4aLsdb5jasphLVmU4qcxsUtaDrAemQmvlr0LMJrjDsBAuAOxha9A/bLxcppoqQYNrYvzsCsvXelVAbFJpfmKjbDSI11eeKBJ4/2ZhFVFEhbXYgnW+5EA5mJdIlOw1RAOH/SXU9tGJgD3yz24=
file_glob: true
file: global-ban-list-*.tgz
skip_cleanup: true
on:
tags: true
repo: CatalysmsServerManager/Global-ban-list

- provider: pages
skip_cleanup: true
keep-history: true
local_dir: docs/api
github_token:
secure: Ap+NxH5ncMku3xn9U5vmgMLlsSv4Njp0nFyAuKVH8Vr7YAQWb9VsNceH3XyOebaNZaU8mPZyorXCznH/T0rUMf/5VIVc4mQ+NtdXczNORLa3Mro0Z5XQdAW5y3Z3x6amg8V2n8OQolkO5cwm1lxiIVAKlbH+tekhpgExIm5mF7kqjwMDVuRyFkKrEMaNgzB3cDfSPP4YAh3Wl6Kbs9kZZZKn2zcPQU2fAT5wUV/4qdLwfE5qrJAeSEUHh6v5Ro8AF0zcu2XvdPK+ykMDSirtOVHGejJZWrRRvXw69EVuNdHGBWPdg8B3sujw0G6m9J9liyFbV/C1B1DtQ/1kIJn2cjZ9VpZjkjk9FyVFxs/YGx7O1lTCiVFMOEfNudKpe7XFqu11z2FVsc2GqTbiblgUs4F6YpwiLQuHefg+xav12Ikz98fAVZj3s15tEr/21smGp5s2m2IsuiPikOmZ591c9TTPV9KO6mNTM0AwyK7ZoDC6t2MqMkSCO+7Oe0FBG5bYq6O4Vauc8iEf4FCS1qHhQkndolO4aLsdb5jasphLVmU4qcxsUtaDrAemQmvlr0LMJrjDsBAuAOxha9A/bLxcppoqQYNrYvzsCsvXelVAbFJpfmKjbDSI11eeKBJ4/2ZhFVFEhbXYgnW+5EA5mJdIlOw1RAOH/SXU9tGJgD3yz24=
on:
all_branches: true
tags: true
repo: CatalysmsServerManager/Global-ban-list
6 changes: 6 additions & 0 deletions apidoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Global ban list",
"description": "API documentation for the global ban list",
"title": "GBL API",
"url" : "https://api.github.com/v1"
}
16 changes: 5 additions & 11 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const path = require('path');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const fs = require('fs');
const bodyParser = require('body-parser');


const app = express();

Expand Down Expand Up @@ -37,11 +39,6 @@ app.models.sequelize.sync().then(() => {
});
});


const usersRouter = require('./routes/users')(app);
const bansRouter = require('./routes/bans')(app);
const pagesRouter = require('./routes/pages')(app);

// view engine setup
app.set('view engine', 'pug');
app.set('views', path.join(__dirname, 'views'));
Expand All @@ -54,16 +51,14 @@ app.use(express.json());
app.use(express.urlencoded({
extended: false,
}));
app.use(bodyParser.json());
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', pagesRouter);
app.use('/user', usersRouter);
app.use('/ban', bansRouter);

require('./routes')(app);
// catch 404 and forward to error handler
app.use((req, res, next) => {
next(createError(404));
next(createError(404, 'This page does not exist.'));
});

// error handler
Expand All @@ -78,7 +73,6 @@ app.use((err, req, res) => {
res.render('error');
});


// Register helper functions
app.helpers = {};
fs
Expand Down
1 change: 0 additions & 1 deletion bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

var app = require('../app');
var debug = require('debug')('global-ban-list:server');
var http = require('http');


Expand Down
Loading

0 comments on commit 6665648

Please sign in to comment.