Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 reformatting, legacy packages deprecation and Russian language addition #56

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
129 changes: 128 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,132 @@

# Created by https://www.gitignore.io/api/node,linux,windows,visualstudiocode

### Linux ###
*~
.*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk


# End of https://www.gitignore.io/api/node,linux,windows,visualstudiocode

*~
.*~
tools/runkeeper/
docker-compose.override.yml
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM node:alpine
FROM node:alpine

MAINTAINER https://github.com/anders94/blockchain-demo

EXPOSE 3000

WORKDIR /blockchain-demo
WORKDIR /blockchain-demo

COPY package.json /blockchain-demo

RUN npm install

COPY . /blockchain-demo
COPY . /blockchain-demo

CMD ["bin/www"]
70 changes: 35 additions & 35 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
var express = require('express');
var i18n = require('i18n');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
const express = require('express')
const i18n = require('i18n')
const path = require('path')
const favicon = require('serve-favicon')
const logger = require('morgan')
const cookieParser = require('cookie-parser')
const bodyParser = require('body-parser')

var routes = require('./routes/index');
const routes = require('./routes/index')

var app = express();
const app = express()

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'pug')

app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(i18n.init);
app.use(express.static(path.join(__dirname, 'public')));
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))
app.use(logger('dev'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(cookieParser())
app.use(i18n.init)
app.use(express.static(path.join(__dirname, 'public')))

app.use('/', routes);
app.use('/', routes)

// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
app.use((req, res, next) => {
const err = new Error('Not Found')
err.status = 404
next(err)
})

// error handlers

// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
app.use((err, req, res, next) => {
res.status(err.status || 500)
res.render('error', {
message: err.message,
error: err
});
});
})
})
}

// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
app.use((err, req, res, next) => {
res.status(err.status || 500)
res.render('error', {
message: err.message,
error: {}
});
});
})
})

i18n.configure({
locales:['en', 'ja', 'pt', 'es', 'pl', 'zh-CN', 'de','ko'],
locales: ['en', 'ja', 'ru', 'pt', 'es', 'pl', 'zh-CN', 'de', 'ko'],
directory: __dirname + '/locales'
});
})

module.exports = app;
module.exports = app
2 changes: 1 addition & 1 deletion locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"Peer": "Peer",
"Tx": "Tx",
"$": "$"
}
}
14 changes: 12 additions & 2 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,15 @@
"Blockchain": "Blockchain",
"Distributed": "Distributed",
"Tokens": "Tokens",
"Coinbase": "Coinbase"
}
"Coinbase": "Coinbase",
"Nonce": "Nonce",
"Data": "Data",
"Mine": "Mine",
"Prev": "Prev",
"Distributed Blockchain": "Distributed Blockchain",
"Peer": "Peer",
"Coinbase Transactions": "Coinbase Transactions",
"$": "$",
"Tx": "Tx",
"From": "From"
}
2 changes: 1 addition & 1 deletion locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"$": "$",
"From": "De",
"Coinbase Transactions": "Transacciones Coinbase"
}
}
2 changes: 1 addition & 1 deletion locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"$": "₹",
"From": "ओर से",
"Coinbase Transactions": "Coinbase Transactions"
}
}
2 changes: 1 addition & 1 deletion locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"$": "₩",
"From": "보낸 이",
"Coinbase Transactions": "코인베이스 거래"
}
}
19 changes: 19 additions & 0 deletions locales/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"Hash": "Хэш-сумма",
"Blockchain Demo": "Демо блокчейна",
"Block": "Блок",
"Blockchain": "Блокчейн",
"Distributed": "Распределение",
"Tokens": "Токены",
"Coinbase": "Coinbase",
"Nonce": "Nonce",
"Data": "Данные",
"Mine": "Майн",
"Prev": "Предыдуший",
"Distributed Blockchain": "Распределённый блокчейн",
"Peer": "Peer",
"Coinbase Transactions": "Coinbase транзакции",
"$": "$",
"Tx": "Транзакции",
"From": "От"
}
2 changes: 1 addition & 1 deletion locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"$": "¥",
"From": "从",
"Coinbase Transactions": "币基交易"
}
}
Loading