Giter Site home page Giter Site logo

mongoose-example's Introduction

mongoose-example

a mongoose example project

目录结构

.
├── app.js
└── models
    └── record.js

流程

  1. 先要建立 mongo 连接:app.js 中的 connect
  2. 绑定一个文档结构:models/record.js,在 app.js 中有引用
  3. 然后根据这个结构可以增加、修改、删除、查询文档, app.js 中使用

运行

git clone [email protected]:dead-horse/mongoose-example.git
cd mongoose-example
npm install
node app.js

访问

http://localhost:7001/records : 查看所有的记录
http://localhost:7001/records/top : 查看分数 top 3 的记录
http://localhost:7001/records/add?name=dead_horse&score=100 : 新增一条记录
http://localhost:7001/records/clean : 清除所有的记录

Lincense

MIT

mongoose-example's People

Contributors

dead-horse 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.