Giter VIP home page Giter VIP logo

messagesapp's Introduction

MessageApp Documentation

Error handling

  • 200 - OK
  • 400 - Bad Request
  • 404 - Not Found
  • 429 - Too Many Request
  • 500 - Internal Server Error

Headers

{ 'Content-Type': 'application/json' }

Request & Response Examples

GET /messages

Example: http://localhost:5000/api/v1/messages

Response body: { "createdAt": "2018-04-10T13:05:29.805Z", "_id": "5accb69940e7593154fb2d88", __ "to": { "createdAt": "2018-04-10T13:05:14.157Z", "_id": "5accb68a40e7593154fb2d87", __ "name": "Maria", "__v": 0 ___
}, "from": { "createdAt": "2018-04-10T13:04:56.811Z", "_id": "5accb67840e7593154fb2d86", __ "name": "Juan", "__v": 0 ___
}, "contents": "Hello Maria", "lang": "en", "open": "false", "__v": 0 ___ } __

POST /messages

Example: Create โ€“ POST http://localhost:5000/api/v1/messages

Request body:

  {
      to: '5basjh7237by8dsb8ds',
      from: 'sdbsjdhbu287g8bsdfbjh',
      contents: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt',
      lang: 'en'
  }

PUT /messages

Example: Update โ€“ PUT http://localhost:5000/api/v1/messages

Request body:

  {
      _id: '5basjh7237by8sdfsddsb8ds',                                                    __
      to: '5basjh7237by8dsb8ds',
      from: 'sdbsjdhbu287g8bsdfbjh',
      contents: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt',
      lang: 'en'
  }

DELETE /messages/:id

Example: http://localhost:5000/api/v1/messages/:id

GET /messages/sent/:user

Example: http://localhost:5000/api/v1/messages/sent/:user

Response body:

[ { "createdAt": "2018-04-10T13:05:29.805Z", "_id": "5accb69940e7593154fb2d88", __ "to": { "createdAt": "2018-04-10T13:05:14.157Z", "_id": "5accb68a40e7593154fb2d87", __ "name": "Maria", "__v": 0 ___ }, "from": { "createdAt": "2018-04-10T13:04:56.811Z", "_id": "5accb67840e7593154fb2d86", __ "name": "Juan", "__v": 0 ___ }, "contents": "Hello Maria", "lang": "en", "open": "false", "__v": 0 ____ }, { ... } ] __

GET /messages/received/:user

Example: http://localhost:5000/api/v1/messages/received/:user

Response body:

[
  {
      "createdAt": "2018-04-10T13:05:29.805Z",
      "_id": "5accb69940e7593154fb2d88",                                    __
      "to": {
          "createdAt": "2018-04-10T13:05:14.157Z",
          "_id": "5accb68a40e7593154fb2d87",                                __
          "name": "Maria",
          "__v": 0                                                          ___
      },
      "from": {
          "createdAt": "2018-04-10T13:04:56.811Z",
          "_id": "5accb67840e7593154fb2d86",                                __
          "name": "Juan",
          "__v": 0                                                          ___
      },
      "contents": "Hello Maria",
      "lang": "en",
      "open": "false",
      "__v": 0                                                              ___
  },
  {
    ...
  }
]
__

GET /messages/perlanguage/:lang

Example: http://localhost:5000/api/v1/messages/perlanguage/:lang

Response body:

[ { "createdAt": "2018-04-10T13:05:29.805Z", "_id": "5accb69940e7593154fb2d88", __ "to": { "createdAt": "2018-04-10T13:05:14.157Z", "_id": "5accb68a40e7593154fb2d87", __ "name": "Maria", "__v": 0 ___ }, "from": { "createdAt": "2018-04-10T13:04:56.811Z", "_id": "5accb67840e7593154fb2d86", __ "name": "Juan", "__v": 0 ___ }, "contents": "Hello Maria",
"lang": "en", "open": "false", "__v": 0 ___ }, { ... } ] __

GET /messages/historial/:from/:to

Example: http://localhost:5000/api/v1/messages/historial/:from/:to

Response body:

[ { "createdAt": "2018-04-10T13:05:29.805Z", "_id": "5accb69940e7593154fb2d88", __ "to": { "createdAt": "2018-04-10T13:05:14.157Z", "_id": "5accb68a40e7593154fb2d87", __ "name": "Maria", "__v": 0 ___ }, "from": { "createdAt": "2018-04-10T13:04:56.811Z", "_id": "5accb67840e7593154fb2d86", __ "name": "Juan", "__v": 0 ___ }, "contents": "Hello Maria", "lang": "en", "open": "false", "__v": 0 ___ }, { ... } ] __

GET /messages/:id/translate/:lang

Example: http://localhost:5000/api/v1/messages/:id/translate/:lang

Response body:

{
    "createdAt": "2018-04-10T13:05:29.805Z",
    "_id": "5accb69940e7593154fb2d88",                                      __
    "to": {
        "createdAt": "2018-04-10T13:05:14.157Z",
        "_id": "5accb68a40e7593154fb2d87",                                  __
        "name": "Maria",
        "__v": 0                                                            ___
    },
    "from": {
        "createdAt": "2018-04-10T13:04:56.811Z",
        "_id": "5accb67840e7593154fb2d86",                                  __
        "name": "Juan",
        "__v": 0                                                            ___
    },
    "contents": "Hello Maria",
    "lang": "en",
    "open": "false",
    "__v": 0                                                                ___
}

__

Commands

  • npm install
  • npm run watch
  • npm start

messagesapp's People

Contributors

cristianperalta 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.