Introduction
Introduction Statistics Contact Development Disclaimer Help
Adding gzip compression, updating routes. - seedlinux - Torrent indexing tool o…
Log
Files
Refs
README
---
commit 5ed806a50c673e56c40ee5db58ae39beae558224
parent 884526fd2dfb89157e0d60a31bd7e338acc5569c
Author: Jay Scott <[email protected]>
Date: Thu, 6 Jul 2017 13:04:49 +0100
Adding gzip compression, updating routes.
I am adding gzip compression for obvious reasons but also
removing the /torrent route as its really not needed.
Diffstat:
M app.js | 4 ++--
M bin/parse | 3 ++-
M controllers/torrents_controller.js | 2 +-
M package.json | 1 +
M routes/index.js | 3 ++-
D routes/torrent_route.js | 10 ----------
6 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/app.js b/app.js
@@ -7,9 +7,9 @@ const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const helmet = require('helmet');
+const compression = require('compression');
const config = require('./app/config');
-const torrent = require('./routes/torrent_route');
const index = require('./routes/index');
const mongoDB = config.dbURI;
@@ -27,6 +27,7 @@ app.use(helmet({
hsts: false
}));
+app.use(compression());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
@@ -39,7 +40,6 @@ app.use(function(req,res,next){
});
app.use('/', index);
-app.use('/torrent/', torrent);
app.use(function(req, res, next) {
var err = new Error('Not Found');
diff --git a/bin/parse b/bin/parse
@@ -5,10 +5,11 @@ console.log('Parsing torrent folder');
const async = require('async');
const mongoose = require('mongoose');
-const mongoDB = process.env.DB_URI;
const parseTorrent = require('parse-torrent');
const Torrent = require('../models/torrent_model');
const fs = require('fs');
+const config = require('../app/config');
+const mongoDB = config.dbURI;
const torrentFolder = './data/torrents';
diff --git a/controllers/torrents_controller.js b/controllers/torrents_controll…
@@ -137,7 +137,7 @@ exports.torrent_update = function(req, res) {
else if (err)
res.sendStatus(500);
else
- res.redirect('/torrent/details/' + req.params.id);
+ res.redirect('/details/' + req.params.id);
}
);
};
\ No newline at end of file
diff --git a/package.json b/package.json
@@ -11,6 +11,7 @@
"dependencies": {
"async": "^2.5.0",
"body-parser": "^1.17.2",
+ "compression": "^1.6.2",
"cookie-parser": "^1.4.3",
"debug": "^2.6.8",
"express": "^4.15.3",
diff --git a/routes/index.js b/routes/index.js
@@ -5,5 +5,6 @@ const router = express.Router();
const torrent_controller = require('../controllers/torrents_controller');
router.get('/', torrent_controller.index);
-
+router.get('/details/:id', torrent_controller.torrent_detail);
+router.get('/update/:id', torrent_controller.torrent_update);
module.exports = router;
diff --git a/routes/torrent_route.js b/routes/torrent_route.js
@@ -1,10 +0,0 @@
-'use strict';
-
-const express = require('express');
-const router = express.Router();
-const torrent_controller = require('../controllers/torrents_controller');
-
-router.get('/details/:id', torrent_controller.torrent_detail);
-router.get('/update/:id', torrent_controller.torrent_update);
-
-module.exports = router;
You are viewing proxied material from ams.jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.