Code Monkey home page Code Monkey logo

201704blog's Introduction

初始化项目

npm init -y

安装依赖的模块

npm install express cookie-parser body-parser express-session connect-mongo connect-flash multer ejs mongoose debug  bootstrap -S

上传文件

  1. 增加一个type=file的字段 如果你想上传文件的话,必须给form增加这个属性
  2. 给表单增加一个属性 enctype="multipart/form-data"
  3. 使用multer中间件,得到req.file属性
  4. 给用户对象增加avatar属性
  5. 在模板里显示用户头像

设计路由

首页路由

请求方式 路径 功能
GET / 首页

用户路由

请求方式 路径 功能
GET /user/signup 注册
POST /user/signup 提交注册表单
GET /user/signin 登录
POST /user/signin 提交登录表单
GET /user/signout 退出

分类路由

请求方式 路径 功能
GET /category/list 查看分类列表
GET /category/add 得到增加分类表单
POST /category/add 提交增加分类表单

设计数据库

用户模型

字段名 字段类型
username 用户名
password 密码
email 邮箱
avatar 头像

分类模型

字段名 字段类型
name 分类名称

功能列表

  1. 信息提示

201704blog's People

Contributors

zhufengnodejs avatar

Watchers

 avatar  avatar

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.