Giter VIP home page Giter VIP logo

201701blog's Introduction

新建一个项目

npm init -y

这个命令会创建一个package.json文件

安装依赖的模块

npm install body-parser  cookie-parser debug ejs express morgan se
rve-favicon express-session connect-mongo mongoose connect-flash multer async bootstrap --save
  • --save-dev = -D
  • --save = -S

创建并初始git

git init
git add -A
git commit -m"1. 初始化项目和依赖的模块"
git remote add origin https://github.com/zhufengnodejs/201701blog.git
git push origin master

创建服务

express + mongoose

let express = require('express');
let app = express();

app.listen(8080);

跑通路由

引入模板引擎

编写步骤


  1. 初始化项目和依赖的模块
  2. 跑通路由
  3. 使用bootstrap渲染模板
  4. 实现用户注册的功能
  5. 实现用户的登录功能
  6. 实现会话功能并控制菜单显示
  7. 增加登录状态判断中间件
  8. 成功和失败时的消息提示
  9. 实现上传头像并在导航的右上角显示个人信息
    1. 在注册表单增加一个头像的字段
    2. 给表单增加一个属性 enctype="multipart/form-data"
    3. user路由中引入multer中间件,并在注册请求中用此中间件解析请求体得到req.filereq.body
    4. 拼出avatar图片路径并赋给req.body对象
    5. 在User模型中添加avatar属性
  10. 新增发表文章
  11. 首页显示文章列表
  12. 编写文章详情页
  13. 删除文章
  14. 更新文章
  15. 实现搜索功能
  16. 实现分页的功能

201701blog's People

Contributors

zhufengnodejs avatar

Watchers

James Cloos 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.