Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a2e2457

Browse files
committedApr 9, 2017
support single article pages
1 parent 16b7ec8 commit a2e2457

File tree

9 files changed

+30
-13
lines changed

9 files changed

+30
-13
lines changed
 

‎index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ var port = process.env.PORT || 8000;
66

77
app.use(express.static('static'));
88

9+
app.get('/articles/:articleID', function(req, res) {
10+
res.sendFile(path.join(__dirname, 'static/label.html'));
11+
});
12+
913
app.get('/bookmarklet/js', function(req, res) {
1014
res.redirect(301, '/bookmarklet.js');
1115
});

‎package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "feedreader-website",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "What happens at feedreader.co",
55
"main": "index.js",
66
"scripts": {
@@ -19,10 +19,13 @@
1919
},
2020
"homepage": "https://github.com/feedreaderco/web#readme",
2121
"dependencies": {
22-
"babel-core": "^6.5.1",
23-
"babel-loader": "^6.2.2",
24-
"babel-preset-es2015": "^6.5.0",
2522
"express": "^4.13.4",
2623
"webpack": "^1.12.13"
24+
},
25+
"devDependencies": {
26+
"babel-core": "^6.24.1",
27+
"babel-loader": "^6.4.1",
28+
"babel-preset-es2015": "^6.24.1",
29+
"webpack": "^1.14.0"
2730
}
2831
}

‎api.js renamed to ‎src/api.js

File renamed without changes.
File renamed without changes.

‎login.js renamed to ‎src/login.js

File renamed without changes.

‎main.js renamed to ‎src/main.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var labelArticles = {};
77
var token = localStorage.token;
88
var pathname_split = window.location.pathname.split('/');
99
var hash = pathname_split.pop();
10+
var isArticle = pathname_split[pathname_split.length - 1] === 'articles';
1011
var pathname = pathname_split.join('/');
1112
var user = localStorage.user;
1213
var viewedFeed = '';
@@ -134,6 +135,7 @@ function get_labels(callback) {
134135

135136
function get_articles(callback) {
136137
var pathname_stripped = pathname.slice(1, -1);
138+
137139
api('GET', pathname_stripped, function(response) {
138140
if (response.articles) {
139141
var i = 0;
@@ -289,8 +291,16 @@ if (user) {
289291
userH2.innerHTML = 'Login';
290292
}
291293

292-
get_articles(function() {
293-
get_folders(function() {
294-
get_labels(refresh_feeds);
294+
if (hash && isArticle) {
295+
get_article(hash, function() {
296+
get_folders(function() {
297+
get_labels(refresh_feeds);
298+
});
299+
});
300+
} else {
301+
get_articles(function() {
302+
get_folders(function() {
303+
get_labels(refresh_feeds);
304+
});
295305
});
296-
});
306+
}

‎signup.js renamed to ‎src/signup.js

File renamed without changes.
File renamed without changes.

‎webpack.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ var webpack = require('webpack');
33

44
module.exports = {
55
entry: {
6-
main: './main.js',
7-
userpage: './userpage.js',
8-
login: './login.js',
9-
signup: './signup.js',
10-
bookmarklet: './bookmarklet.js'
6+
main: './src/main.js',
7+
userpage: './src/userpage.js',
8+
login: './src/login.js',
9+
signup: './src/signup.js',
10+
bookmarklet: './src/bookmarklet.js'
1111
},
1212
output: {
1313
path: path.join(__dirname, 'static'),

0 commit comments

Comments
 (0)
Please sign in to comment.