Giter VIP home page Giter VIP logo

nodecms's Introduction

介绍

学习nodejs入门项目,数据库使用的MySQL。 使用nodejs 开发定位于企业网站的简易CMS,目标为容易拓展、部署,前端开发者容易使用的CMS系统。

特性

  • 使用nodejs 开发,为前端开发者准备的,前后端都使用JS,做个企业网站就很容易了
  • 简单(其实是懒),主要是首页、根据数据模型的列表页、详情页,单页,满足一般企业站点需要
  • 容易拓展,功能不满足可以容易拓展
  • 多模板
  • 支持不同模型列表、详情指定模板,更加灵活嵌入单页

安装

  • 使用 克隆或直接下载项目到本地

      git clone https://github.com/linksgo2011/nodecms.git
    
  • 在根目录下使用命令行执行下面代码,安装nodejs 依赖的模块

      npm install 
    
  • 在根目录下找到nodecms.sql文件,导入到你的MySQL数据库中

  • 修改config/connections.js 文件,根据上一步的数据库信息,修改数据库连接

      // 修改数据库连接地址
      someMysqlServer: {
          host: 'localhost',
          user: 'root',
          password: '',
          database: 'nodecms'
      },
    
  • 启动项目

      node app.js
    

预览

demo 地址 http://nodecms.printf.cn/

后台地址 /admin/user/login
默认用户 admin admin

贡献代码

[email protected]

nodecms's People

Contributors

canfeit avatar linksgo2011 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodecms's Issues

生产环境中grunt报错 Uglifying source .tmp/public/concat/production.js failed.

Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
** Grunt :: An error occurred. **

error:

Aborted due to warnings.
Running "uglify:dist" (uglify) task
JS_Parse_Error {
message: 'Unexpected token: punc ({)',
filename: '../concat/production.js',
line: 1815,
col: 10,
pos: 156176,
stack: 'Error\n at new JS_Parse_Error (eval at (nodecms\node_modules\grunt-contrib-uglify\node_modules\uglify-js\tools\node.js:22:1), :1526:18)\n at js_err
or (eval at (nodecms\node_modules\grunt-contrib-uglify\node_modules\uglify-js\tools\node.js:22:1), :1534:11)\n at croak (eval at (nodecms\node_modules\grunt-contrib-uglify\node_modules\uglify-js\tools\node.js:22:1), :2025:9)\n at token_error (eval at (nodecms\node_modules
grunt-contrib-uglify\node_modules\uglify-js\tools\node.js:22:1), :2033:9)\n at unexpected (eval at (nodecms\node_modules\grunt-contrib-uglify\node_modules\ugl
ify-js\tools\node.js:22:1), :2039:9)\n at semicolon (eval at (nodecms\node_modules\grunt-contrib-uglify\node_modules\uglify-js\tools\node.js:22:1), <anonymous

:2059:43)\n at eval (eval at (nodecms\node_modules\grunt-contrib-uglify\node_modules\uglify-js\tools\node.js:22:1), :2193:38)\n at eval (eval at
(nodecms\node_modules\grunt-contrib-uglify\node_modules\uglify-js\tools\node.js:22:1), :2072:24)\n at block_ (eval at (nodecms
\node_modules\grunt-contrib-uglify\node_modules\uglify-js\tools\node.js:22:1), :2352:20)\n at eval (eval at (nodecms\node_modules\grunt-contrib-uglify\node_m
odules\uglify-js\tools\node.js:22:1), :2325:25)' }

Uglifying source .tmp/public/concat/production.js failed.
Warning: Uglification failed.
Unexpected token: punc ({).
Line 1815 in .tmp/public/concat/production.js


error: Looks like a Grunt error occurred--
error: Please fix it, then restart Sails to continue running tasks (e.g. watching for changes in assets)
error: Or if you're stuck, check out the troubleshooting tips below.

error: Troubleshooting tips:
error:
error: *-> Are "grunt" and related grunt task modules installed locally? Run npm install if you're not sure.
error:
error: *-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
error:
error: *-> Or maybe you don't have permissions to access the .tmp directory?
error: e.g., nodecms\.tmp ?
error:
error: If you think this might be the case, try running:
error: sudo chown -R YOUR_COMPUTER_USER_NAME nodecms.tmp

Error: The hook grunt is taking too long to load.
Make sure it is triggering its initialize() callback, or else set sails.config.grunt._hookTimeout to a higher value (currently 20000) at tooLong [as _onTimeout] (nodecms\node_modules\sails\lib\app\private\loadHooks.js:85:21) at Timer.listOnTimeout (timers.js:92:15) { [Error: The hookgruntis taking too long to load. Make sure it is triggering itsinitialize()callback, or else setsails.config.grunt._hookTimeout to a higher value (currently 20000)] code: 'E_HOOK_TIMEOUT' }

递归获取子树方法需要优化

nodecms/api/models/Admin/Purview.js

getsubTree函数
delete records[key]; 改为 data.splice(key, 1);

for (var i = rs.length - 1; i >= 0; i--) {
rs[i].children = getsubTree(parent_id + 1, records);
}
改为
for (var i = rs.length - 1; i >= 0; i--) {
rs[i].children = getsubTree(rs[i].id, records);
}
由于源码中导航不涉及到排序功能,所以没有发现这种累加方式有不妥之处,这样优化即可,不谢。

启动项目报错

错误信息如下:
events.js:141
throw er; // Unhandled 'error' event
^

Error: listen EACCES 0.0.0.0:80
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at Server._listen2 (net.js:1224:19)
at listen (net.js:1273:10)
at Server.listen (net.js:1369:5)
at Array.async.auto.start (E:\GitHub Project\nodecms\node_modules\sails\lib
hooks\http\start.js:29:35)
at E:\GitHub Project\nodecms\node_modules\async\lib\async.js:484:38
at _each (E:\GitHub Project\nodecms\node_modules\async\lib\async.js:46:13)
at Object.async.auto (E:\GitHub Project\nodecms\node_modules\async\lib\async
.js:455:9)
at Sails.startServer (E:\GitHub Project\nodecms\node_modules\sails\lib\hooks
\http\start.js:16:11)
at emitNone (events.js:67:13)
at Sails.emit (events.js:166:7)
at Sails.emitter.emit (E:\GitHub Project\nodecms\node_modules\sails\lib\app
private\after.js:50:11)
at afterBootstrap (E:\GitHub Project\nodecms\node_modules\sails\lib\app\priv
ate\initialize.js:56:11)
at bootstrapDone (E:\GitHub Project\nodecms\node_modules\sails\lib\app\priva
te\bootstrap.js:51:14)
at Object.module.exports.bootstrap (E:\GitHub Project\nodecms\config\bootstr
ap.js:16:3)

尝试安装了nodecms,启动时遇错

报错信息如下:请问是什么问题?
error: Looks like a Grunt error occurred--
error: Please fix it, then restart Sails to continue running tasks (e.g. watching for changes in assets)
error: Or if you're stuck, check out the troubleshooting tips below.

error: Troubleshooting tips:
error:
error: *-> Are "grunt" and related grunt task modules installed locally? Run npm install if you're not sure.
error:
error: *-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
error:
error: *-> Or maybe you don't have permissions to access the .tmp directory?
error: e.g., /home/ubuntu/workspace/nodecms/.tmp ?
error:
error: If you think this might be the case, try running:
error: sudo chown -R 1000 /home/ubuntu/workspace/nodecms/.tmp

后台上传图片报错,无法上传

上传图片报这个错误:
{
"error": 0,
"url": "/uploads/2016-09-15/929443763265.jpg"
}
VM15519:4 Uncaught SyntaxError: Unexpected token < in JSON at position 65

麻烦看一下返回的json不对?

克隆下来用不了

看上去是sails.js开发的,但是package.json里面的依赖项却只有两个! 反正就是用不了,我是的sails新手,很想学习一下。可以解决一下么

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.