Code Monkey home page Code Monkey logo

blog's Introduction

1. 起步

git clone https://github.com/HsyangG/crud-express.git

npm install

2. 启动数据库服务

数据库是 MongoDB

mongod

mongo

3. 开启服务器

cd 项目所在文件目录

node app.js

4. 模板页

##3. 路由设计

路径 方法 get 参数 post 参数 是否需要权限 备注
/ GET 渲染首页
/register GET 渲染注册页面
/register POST email、nickname、password 处理注册请求
/login GET 渲染登录页面
/login POST email、password 处理登录请求
/llogout GET 处理退出请求

5. 模型设计

6. 功能实现

7. 书写步骤

  • 创建目录结构
  • 整合静态页-模板页
    • include
    • block
    • extend
  • 设计用户注册、登录、退出的路由
    • 客户端:
      • 先处理好页面内容(表单控件的 name、收集表单数据、发起请求)
    • 服务端:
      • 获取客户端表单请求数据
      • 操作数据库
      • 如果有错,发送 500 告诉客户端服务器错了
      • 其他根据自己的业务需求发送不同的响应数据
  • 用户注册
  • 用户登录用户退出

blog's People

Contributors

atlan8 avatar

Watchers

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