forked from caibojian/cjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d9c921b
Showing
117 changed files
with
24,017 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var express = require('express'); | ||
var session = require('express-session'); | ||
var path = require('path'); | ||
var bodyParser = require('body-parser'); | ||
//模板引擎 | ||
var partials = require('express-partials'); | ||
|
||
var adminServer = require('./routes/adminServer'); | ||
var admin = require('./routes/admin'); | ||
/*实例化express对象*/ | ||
var app = express(); | ||
//session配置 | ||
app.use(session({ | ||
secret: 'caibojian', | ||
resave: false, | ||
saveUninitialized: true | ||
})); | ||
|
||
app.use(bodyParser.json({limit: '50mb'})); // 限制上传5M | ||
app.use(bodyParser.urlencoded({ extended: false , limit: '50mb' })); | ||
app.set('views', path.join(__dirname, 'views')); | ||
app.set('view engine', 'ejs'); | ||
app.use(express.static(path.join(__dirname, 'public'))); | ||
app.use(partials()); | ||
|
||
/*指定路由控制*/ | ||
app.use('/admin', admin); | ||
app.use('/admin', adminServer); | ||
|
||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var app = require('../app'); | ||
var debug = require('debug')('doracms:server'); | ||
var http = require('http'); | ||
|
||
/** | ||
* Get port from environment and store in Express. | ||
*/ | ||
|
||
var port = normalizePort(process.env.PORT || '8888 '); | ||
app.set('port', port); | ||
|
||
/** | ||
* Create HTTP server. | ||
*/ | ||
|
||
var server = http.createServer(app); | ||
|
||
/** | ||
* Listen on provided port, on all network interfaces. | ||
*/ | ||
|
||
server.listen(port); | ||
server.on('error', onError); | ||
server.on('listening', onListening); | ||
|
||
/** | ||
* Normalize a port into a number, string, or false. | ||
*/ | ||
|
||
function normalizePort(val) { | ||
var port = parseInt(val, 10); | ||
|
||
if (isNaN(port)) { | ||
// named pipe | ||
return val; | ||
} | ||
|
||
if (port >= 0) { | ||
// port number | ||
return port; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Event listener for HTTP server "error" event. | ||
*/ | ||
|
||
function onError(error) { | ||
if (error.syscall !== 'listen') { | ||
throw error; | ||
} | ||
|
||
var bind = typeof port === 'string' | ||
? 'Pipe ' + port | ||
: 'Port ' + port; | ||
|
||
// handle specific listen errors with friendly messages | ||
switch (error.code) { | ||
case 'EACCES': | ||
console.error(bind + ' requires elevated privileges'); | ||
process.exit(1); | ||
break; | ||
case 'EADDRINUSE': | ||
console.error(bind + ' is already in use'); | ||
process.exit(1); | ||
break; | ||
default: | ||
throw error; | ||
} | ||
} | ||
|
||
/** | ||
* Event listener for HTTP server "listening" event. | ||
*/ | ||
|
||
function onListening() { | ||
var addr = server.address(); | ||
var bind = typeof addr === 'string' | ||
? 'pipe ' + addr | ||
: 'port ' + addr.port; | ||
debug('Listening on ' + bind); | ||
} | ||
|
||
//var io = app.io; | ||
//io.attach( server ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"name": "cjs", | ||
"version": "1.0.0", | ||
"description": "node.js ", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://git.oschina.net/caibojian/cjs.git" | ||
}, | ||
"keywords": [ | ||
"cjs" | ||
], | ||
"author": "caibojian", | ||
"license": "ISC", | ||
"dependencies": { | ||
"archiver": "^0.14.4", | ||
"body-parser": "~1.12.0", | ||
"compression": "^1.4.4", | ||
"connect-redis": "^2.5.0", | ||
"cookie-parser": "~1.3.4", | ||
"debug": "~2.1.1", | ||
"ejs": "~2.3.1", | ||
"express": "~4.12.2", | ||
"express-partials": "*", | ||
"express-promise": "^0.4.0", | ||
"express-session": "^1.11.3", | ||
"formidable": "^1.0.17", | ||
"gm": "^1.18.1", | ||
"iconv-lite": "^0.4.13", | ||
"lodash": "^3.10.1", | ||
"moment": "^2.10.3", | ||
"mongoose": "^4.0.1", | ||
"morgan": "~1.5.1", | ||
"nodemailer": "^1.3.4", | ||
"png-word": "0.0.7", | ||
"qr-image": "^3.1.0", | ||
"redis": "^0.12.1", | ||
"request": "^2.67.0", | ||
"serve-favicon": "~2.2.0", | ||
"shortid": "^2.2.2", | ||
"socket.io": "^1.3.7", | ||
"ueditor-nodejs": "^0.1.0", | ||
"unzip": "^0.1.11", | ||
"validator": "^3.37.0" | ||
} | ||
} |
Oops, something went wrong.