Giter Site home page Giter Site logo

restful-express's Introduction

使用

  1. 开启 MongoDB,输入数据 ( MongoDB安装运行 )

  2. 执行

    npm install
    node app.js
    
  3. 使用 postman 调试请求

请求

涉及到 _id 的请求,请求地址请根据数据库中的_id调整

get

获取所有图书信息

http://localhost:3000/api/books

获取单种图书的信息

http://localhost:3000/api/book/58d38737d8eb6ee9811b9325

post

新增一种图书

{
    "title": "JavaScript权威指南",
    "genre": "计算机与互联网",
    "description": "讲述的内容涵盖JavaScript语言本身,以及Web浏览器所实现的JavaScriptAPI",
    "author": "弗兰纳根(David Flanagan)",
    "publisher": "机械工业出版社",
    "pages": "1004",
    "image_url": "https://images-cn.ssl-images-amazon.com/images/I/51QWrj6sodL.jpg",
    "buy_url": "https://www.amazon.cn/dp/B007VISQ1Y/"
}

put

更新一种图书的信息

{
    "title": "JavaScript权威指南(第六版)",
    "genre": "计算机与互联网",
    "description": "讲述的内容涵盖JavaScript语言本身,以及Web浏览器所实现的JavaScriptAPI",
    "author": "弗兰纳根(David Flanagan)",
    "publisher": "机械工业出版社",
    "pages": "1004",
    "image_url": "https://images-cn.ssl-images-amazon.com/images/I/51QWrj6sodL.jpg",
    "buy_url": "https://www.amazon.cn/dp/B007VISQ1Y/"
}

delete

删除一种图书

http://localhost:3000/api/book/59056af8bf39f60ec6027486

视频教程:

https://www.youtube.com/watch?v=eB9Fq9I5ocs

restful-express's People

Contributors

ryanlid avatar

Watchers

 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.