Giter Site home page Giter Site logo

node-website's Introduction

node-website

基于express + mongodb的站点建设

目录结构

./node-website/ --目录
├── models --数据模型
├── node_modules --依赖的node模块
├── public --公用文件
   ├── css  --css文件
   ├── libs --依赖的库
   └── images  --图片文件夹
├── schemas --数据库文档模型及方法函数
├── views   --模版页面
├── app.js  --带数据库版入口文件
└── appMock.js --假数据版入库文件

运行方式

安装node环境

安装项目的依赖模块:node-website下执行

npm install

安装bower:

npm install bower -g

安装bootstrap:node-website下执行

bower install bootstrap

从官网下载mongodb,安装到任意本地目录,在./bin同层的目录下创建 ./data/db 目录

赋予数据库读写权限:

sudo chown -R data

到bin目录下,执行

./mongod —dbpath [data路径]

如果报错mongod命令找不到的话请执行

export PATH="$PATH:/usr/local/mongodb/bin
ctrl + t

启动数据库:再打开一个命令行窗口,执行

./mongo

在node-website目录下

node app

(连接数据库版) 或者

node appMock

(假数据版)

访问localhost:3000即可浏览主页

注:必须同时启动数据库及node服务才可以访问

补充:关于mongodb数据库的安装配置启动问题: 参考资料1 参考资料2

框架&工具

服务端

  1. Express
  2. mongodb
  3. mongoose
  4. jade

...

客户端

  1. bootstrap
  2. jquery

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.