配置文件采取独立的方式
This commit is contained in:
parent
6103281120
commit
3924ab9596
|
|
@ -1,44 +1,45 @@
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|
||||||
# Runtime data
|
# Runtime data
|
||||||
pids
|
pids
|
||||||
*.pid
|
*.pid
|
||||||
*.seed
|
*.seed
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
lib-cov
|
lib-cov
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage
|
||||||
|
|
||||||
# nyc test coverage
|
# nyc test coverage
|
||||||
.nyc_output
|
.nyc_output
|
||||||
|
|
||||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
.grunt
|
.grunt
|
||||||
|
|
||||||
# node-waf configuration
|
# node-waf configuration
|
||||||
.lock-wscript
|
.lock-wscript
|
||||||
|
|
||||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
build/Release
|
build/Release
|
||||||
|
|
||||||
# Dependency directories
|
# Dependency directories
|
||||||
node_modules
|
node_modules
|
||||||
jspm_packages
|
jspm_packages
|
||||||
|
|
||||||
# Optional npm cache directory
|
# Optional npm cache directory
|
||||||
.npm
|
.npm
|
||||||
|
|
||||||
# Optional REPL history
|
# Optional REPL history
|
||||||
.node_repl_history
|
.node_repl_history
|
||||||
|
|
||||||
# Upload File
|
# Upload File
|
||||||
uploads
|
uploads
|
||||||
/public/images/snap/
|
/public/images/snap/
|
||||||
/public/images/favicon/
|
/public/images/favicon/
|
||||||
.tags
|
.tags
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
config.js
|
||||||
|
|
@ -172,7 +172,7 @@ source /home/lcq/schema.sql; // 执行schema.sql文件创建数据库表格。
|
||||||
3、安装Redis 安装教程。如果不会,请戳教程[Redis 安装教程](http://baidu.luchenqun.com/?redis%20%E5%AE%89%E8%A3%85 "Redis 安装教程"),安装完成之后如果Redis没有启动,请启动Redis。
|
3、安装Redis 安装教程。如果不会,请戳教程[Redis 安装教程](http://baidu.luchenqun.com/?redis%20%E5%AE%89%E8%A3%85 "Redis 安装教程"),安装完成之后如果Redis没有启动,请启动Redis。
|
||||||
4、安装Node.js。Node.js版本至少要求8.0以上。不会的话,请按照上面步骤1、3提供的方法自行解决。
|
4、安装Node.js。Node.js版本至少要求8.0以上。不会的话,请按照上面步骤1、3提供的方法自行解决。
|
||||||
5、克隆代码`git@github.com:luchenqun/my-bookmark.git`,切换到项目根目录下面,执行`npm install`安装package。
|
5、克隆代码`git@github.com:luchenqun/my-bookmark.git`,切换到项目根目录下面,执行`npm install`安装package。
|
||||||
6、更新/database/db.js文件的dbConfig配置,将你mysql的数据信息更新上去。
|
6、在根目录,根据`config.default.js`文件内容创建一个新的文件`config.js`,更新你的MySQL的账号密码信息。注意,该账号必须要有写数据库的权限!
|
||||||
7、如果上面的都做好了,在项目根目录下面执行`node ./bin/www`,如果是开发,可以使用`npm start`。
|
7、如果上面的都做好了,在项目根目录下面执行`node ./bin/www`,如果是开发,可以使用`npm start`。
|
||||||
8、在浏览器里面输入:127.0.0.1:2000。
|
8、在浏览器里面输入:127.0.0.1:2000。
|
||||||
9、部署的话,推荐使用nginx作为HTTP和反向代理服务器,使用forever让nodejs应用后台执行。相关知识,请自行百度。
|
9、部署的话,推荐使用nginx作为HTTP和反向代理服务器,使用forever让nodejs应用后台执行。相关知识,请自行百度。
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
module.exports = {
|
||||||
|
'dbConfig': {
|
||||||
|
host: '127.0.0.1',
|
||||||
|
user: 'test', // mysql的账号
|
||||||
|
password: '123456', // mysql 的密码
|
||||||
|
database: 'mybookmarks',
|
||||||
|
multipleStatements: true,
|
||||||
|
useConnectionPooling: true,
|
||||||
|
port: 3306
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,11 @@
|
||||||
var mysql = require('mysql');
|
var mysql = require('mysql');
|
||||||
|
var dbConfig = null;
|
||||||
|
try {
|
||||||
|
dbConfig = require('../config.js').dbConfig;
|
||||||
|
} catch (error) {
|
||||||
|
dbConfig = require('../config.default.js').dbConfig;
|
||||||
|
}
|
||||||
|
|
||||||
var dbConfig = {
|
var dbConfig = {
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
user: 'test', // mysql的账号
|
user: 'test', // mysql的账号
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue