GithubHelp home page GithubHelp logo

hrm-api's Introduction

Koa2 + mongodb 简易后端脚手架

Author: Tenggouwa

Date: 2019.06.26

项目简介

为了方便业务开发,所搭建的 koa + mongodb 脚手架,使用较为主流的内容搭建。

环境搭建

项目运行

  • yarn或者cnpm i或者npm i
  • nodemon app或者node app
  • 本地访问localhost:3000/getBlock或根据router.js使用postman测试

项目结构

目录 说明
/controller 控制层相关文件(提供接口)
/middleware 中间件-可以使用第三方以及自己封装的
/models 数据库模型(传统意义上的表结构)
/views 视图层(可以使用模板引擎展现视图)
/app.js 主要的入口文件(引入一些第三方内容)
/package.json 项目的包管理
/router.js 路由地址,输出接口地址

mongoDB操作

  • 保存数据
    • save()
  • 查取数据
    • 查询 find() finOne()
    • where()
  • 更改数据
    • where().update()
  • 删除数据
    • where().remove()
  • 排序
    • find().sort()
  • 分页
    • find().sort().skip(页码).limit(单页数据)

未完待续

hrm-api's People

Contributors

northseacoder avatar

Watchers

 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.