Really ugly progress commit

This commit is contained in:
Timothy Warren 2016-06-14 10:51:48 -04:00
parent 0eb0d18755
commit 719776e862
16 changed files with 434 additions and 554 deletions

View File

@ -1,3 +1,6 @@
# ProgBlog
A simple node blog with built-in code snippet highlighting
[![Build Status](https://jenkins.timshomepage.net/buildStatus/icon?job=ProgBlog)](https://jenkins.timshomepage.net/job/ProgBlog/)
## Setup

View File

@ -83,7 +83,6 @@ class Container {
return this._require(name);
}
/**
* Get a base library instance
*

View File

@ -2,9 +2,14 @@
const container = require('../Container');
const Model = container.getBase('Model');
const Config = container.getBase('Config');
class DBModel extends Model {
constructor() {
super();
this.db = Config.get('database');
}
}
module.exports = DBModel;

View File

@ -4,7 +4,6 @@
* Base Class for wrapping HTTP/HTTPS servers
*/
class Server {
constructor() {}
/**
* Event listener for HTTP(s) server "error" event.
*

4
app/bootstrap.js vendored
View File

@ -7,7 +7,7 @@ const path = container.get('path');
const Controller = container.get('base/Controller');
const Config = container.get('base/Config');
module.exports = (function () {
module.exports = (() => {
const baseRoutePath = path.join(__dirname, 'controllers');
// Set up templating
@ -28,4 +28,4 @@ module.exports = (function () {
return app;
}());
})();

View File

@ -6,7 +6,7 @@ const knexConn = knexConfig.connection;
const params = {
driver: knexConfig.client,
connection: (knexConfig.client == "sqlite3") ? knexConn.filename : knexConn,
connection: (knexConfig.client == 'sqlite3') ? knexConn.filename : knexConn,
};
const nodeQuery = require('ci-node-query')(params);

View File

@ -25,4 +25,30 @@ module.exports = {
},
},
'/user/list': {
get: (req, res) => {
},
},
'/user/edit': {
get: (req, res) => {
},
post: (req, res) => {
},
},
'/user/add': {
get: (req, res) => {
},
post: (req, res) => {
},
},
};

13
app/models/Blog.js Normal file
View File

@ -0,0 +1,13 @@
'use strict';
const Container = require('../../Container');
const Config = container.get('Config');
const DBModel = container.getBase('DBModel');
class BlogModel extends DBModel {
constructor() {
super();
}
}
module.exports = new BlogModel();

View File

@ -1,4 +1,23 @@
'use strict';
const container = require('../Container');
const Config = container.get('Config');
const DBModel = container.getBase('DBModel');
class UserModel extends DBModel {
constructor() {
super();
}
getAll() {
return this.db.get('users');
}
getUserById(userId) {
return this.db.from('users')
.where('id', userId)
.get();
}
}
module.exports = new UserModel();

View File

@ -65,6 +65,7 @@ Javascript has several ways of making a self-executing function.
<div class="cell cell-1of2 edit-right" id="preview">
</div>
</section>
<button type="submit">Save</button>
</section>
<footer>
<p>&copy; Timothy J. Warren</p>

View File

@ -0,0 +1,2 @@
<form action="/admin/user/add" method="post">
</form>

View File

@ -1,10 +1,10 @@
{
"author": "Timothy J. Warren",
"dependencies": {
"axios": "^0.9.1",
"body-parser": "~1.13.2",
"axios": "^0.12.0",
"body-parser": "~1.15.1",
"ci-node-query": "^4.0.0",
"cookie-parser": "~1.3.5",
"cookie-parser": "~1.4.3",
"debug": "~2.2.0",
"dotenv": "^2.0.0",
"errors": "^0.3.0",
@ -14,16 +14,16 @@
"express-negotiate": "0.0.5",
"express-session": "^1.13.0",
"getargs": "0.0.8",
"glob": "^6.0.4",
"helmet": "^1.1.0",
"glob": "^7.0.3",
"helmet": "^2.1.1",
"highlight.js": "^9.1.0",
"jscs": "^2.11.0",
"knex": "^0.10.0",
"knex": "^0.11.5",
"lodash": "^4.5.0",
"markdown-it": "^6.0.0",
"moment": "^2.11.2",
"morgan": "~1.6.1",
"morgan": "~1.7.0",
"nodemon": "^1.9.0",
"npm-run-all": "^2.1.2",
"nsp": "^2.4.0",
"scrypt": "^6.0.1",
"sqlite3": "^3.1.1",
@ -31,7 +31,7 @@
},
"description": "A simple blog with built-in code snippet functionality",
"devDependencies": {
"apidoc": "^0.15.1",
"apidoc": "^0.16.1",
"chai": "^3.5.0",
"chai-as-promised": "^5.3.0",
"documentation": "^4.0.0-beta1",
@ -40,7 +40,6 @@
"istanbul": "0.4.*",
"jscs": "^3.0.0",
"mocha": "^2.4.5",
"npm-run-all": "^1.6.0",
"nsp": "^2.2.1",
"parallelshell": "^2.0.0",
"pre-commit": "^1.1.2",
@ -72,6 +71,7 @@
"audit": "nsp check",
"build": "npm-run-all --parallel lint:src lint:tests docs:src docs:api coverage",
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha",
"css": "postcss -c postcss.config.json -w",
"default": "npm-run-all --parallel audit lint:src lint:tests test",
"docs": "npm-run-all --parallel docs:src docs:api",
"docs:api": "apidoc -i ./app/ -o ./public/api-docs/",

5
postcss.config.json Normal file
View File

@ -0,0 +1,5 @@
{
"use": "postcss-cssnext",
"input": "public/assets/css/blog.myth.css",
"output": "public/assets/css/blog.css"
}

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,8 @@
-ms-overflow-style: -ms-autohiding-scrollbar;
overflow-y: scroll;
text-rendering: optimizeLegibility;
text-size-adjust: 100%
text-size-adjust: 100%;
scroll-behavior: smooth;
}
* {

View File

@ -31,14 +31,14 @@ function normalizePort(val) {
}
// Create HTTP Server
if (true === config.get('http')) {
if (config.get('http') === true) {
let port = normalizePort(config.get('http-port'));
app.set('port', port);
container.set('http-server', new HttpServer(app, port));
}
// Create HTTPs Server
if (true === config.get('https')) {
if (config.get('https') === true) {
const httpsPort = normalizePort(config.get('https-port'));
const httpsConfig = {
key: fs.readFileSync(config.get('https-config-key')),