Skip to content

Commit bf9c582

Browse files
committed
add 500 page and some refactoring
1 parent be0787f commit bf9c582

File tree

13 files changed

+58
-48
lines changed

13 files changed

+58
-48
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
dist
33
tests
4+
coverage

.eslintrc.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ rules:
1111
prefer-destructuring: [error, {object: false}]
1212
no-console: 0
1313
no-return-await: 0
14-
no-underscore-dangle: 0

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9
1+
8

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ node_js:
88

99
script:
1010
- npm run lint
11+
- npm run mocha
1112
- npm run build
1213

1314
notifications:

package-lock.json

Lines changed: 31 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
22
"name": "shri-4-nodejs",
3-
"version": "1.0.0",
3+
"version": "1.0.3",
44
"scripts": {
55
"lint": "eslint \"**/*.js\"",
66
"mocha": "nyc mocha tests/unit && nyc report --reporter=html --report-dir=\"./coverage/mocha\"",
77
"hermione": "hermione",
8-
"selenium": "selenium-standalone install && selenium-standalone start",
8+
"selenium": "selenium-standalone start",
9+
"selenium-install": "selenium-standalone install",
910
"test": "npm run mocha && npm run hermione",
1011
"clone": "rm -rf repo && git clone --mirror https://github.com/voronin-ivan/test.git repo",
1112
"build": "webpack",
1213
"dev": "webpack --watch | nodemon index.js",
13-
"start": "NODE_ENV=production npm run build && node index.js"
14+
"start": "NODE_ENV=production npm run build && node index.js",
15+
"postinstall": "npm run clone && npm run selenium-install"
1416
},
1517
"repository": {
1618
"type": "git",

server/router.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ router.get('/', async (req, res) => {
1717
});
1818
} catch (error) {
1919
console.error(error);
20-
return res.status(404).render('404');
20+
return error.code === 'ENOENT' ?
21+
res.status(500).render('500') :
22+
res.status(404).render('404');
2123
}
2224
});
2325

server/views/500.pug

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends layout
2+
block head
3+
title='Repository not found'
4+
block content
5+
header
6+
h1.title Repository not found
7+
main
8+
h2 Try 'npm run clone'

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './scss/style.scss';

src/js/main.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)