GithubHelp home page GithubHelp logo

todolist's Introduction

TodoList


一个简单的vue + nodejs项目,前端由vue实现,后端由nodejs(express),数据库采用mongodb


前端:vue 后端:Nodejs 数据库: mongodb

前端

  1. 使用vue-cli脚手架, vue+axio

  2. 实现的功能

    (1) 单条添加todo

    (2) 单条删除todo

    (3) 双击编辑todo

    (4) 单条todo已完成相应样式状态改变

    (5) 全部todo是已完成相应样式状态改变

    (6) 清除全部已完成todos

    (7) 待办todos数量显示

    (8) 所有todos,已完成todos,未完成todos筛选

  3. 接口展示

    import axios from 'axios'
    
    const baseUrl =
    process.env.NODE_ENV === "development" ?
    "https://nei.netease.com/api/apimock/f3e5d93d5eaceda5a624378374ad5cd7"
    : "http://148.70.150.147:8080"
    
    export const getAllTask = params => { return axios.get(`${baseUrl}/api/all`, {params: params}) }
    export const addTask = params => { return axios.post(`${baseUrl}/api/add`, params).then(res => res.data) }
    export const deleteTask = params => { return axios.post(`${baseUrl}/api/deletes`, params).then(res => res.data) }
    export const updateTask = params => { return axios.post(`${baseUrl}/api/update`, params).then(res => res.data) }
    export const updateManyTask = params => { return axios.post(`${baseUrl}/api/updateMany`, params).then(res => res.data) }
    export const deleteCompletedTask = params => { return axios.post(`${baseUrl}/api/deletemany`, params) }

后端


1.后台由express + mongoodb构建。

2.路由

     module.exports = function(app) {
         app.get('/api/all', TodoController.getAll);
         app.post('/api/add', TodoController.newTodo);
         app.post('/api/deletes', TodoController.deleteOne);
         app.post('/api/deletemany', TodoController.deleteAllCompleted);
         app.post('/api/update', TodoController.updateOne);
         app.post('/api/updateMany', TodoController.updateMany);
             ....

项目启动

  1. clone 项目

git clone https://github.com/chengbo1995/TodoList.git

  1. 进入项目,安装依赖
// 安装客户端依赖
cd client
npm install

// 安装服务器端依赖
cd server
npm install
  1. 启动项目
  • 启动服务器:npm start
  • 启动客户端:npm run dev(开发模式)
  1. 浏览器访问 http://localhost:8080
  • 效果图:

TodoList在线效果展示

感觉还行的话给个star,谢谢

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.