1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-02 20:15:25 +02:00

Page model (#1)

* Initial database and page MVC

* Add mocha tests

* Add docs

* Add docs about nedb query options

* Add eslint and editorconfig + husky

* Improve precommit script

* Remove unnecessary dependencies
This commit is contained in:
George Berezhnoy 2018-08-17 13:58:44 +03:00 committed by GitHub
parent 2e717f6415
commit 7add63d90b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 4361 additions and 42 deletions

21
bin/www
View file

@ -3,21 +3,21 @@
/**
* Module dependencies.
*/
const app = require('../app')
const debug = require('debug')('codex.editor.docs:server')
const http = require('http')
const app = require('../app');
const debug = require('debug')('codex.editor.docs:server');
const http = require('http');
/**
* Get port from environment and store in Express.
*/
const port = normalizePort(process.env.PORT || '3000')
const port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
const server = http.createServer(app)
const server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
@ -32,7 +32,7 @@ server.on('listening', onListening);
*/
function normalizePort(val) {
const port = parseInt(val, 10)
const port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
@ -58,7 +58,7 @@ function onError(error) {
const bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
@ -80,9 +80,12 @@ function onError(error) {
*/
function onListening() {
const addr = server.address()
const addr = server.address();
const bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
module.exports = {server, app};