{ "name": "chats", "base": "PersistedModel", "idInjection": true, "options": { "validateUpsert": true }, "properties": { "id": { "type": "ObjectId", "id": true }, "exponente": { "type": "ObjectId", "required": true }, "usuario": { "type": "ObjectId", "required": true }, "mensajes": { "type": "array" } }, "validations": [], "relations": {}, "acls": [], "methods": {}}
'use strict';
module.exports = function(chats) { chats.open = function(exponente, usuario, cb) { chats.findOrCreate( { where: { exponente: exponente, usuario: usuario } }, { exponente: exponente, usuario: usuario, mensajes: [] }, function(err, instance, created) { console.log('Antes del callback'); console.log(instance); cb(null, instance); } ); };
chats.remoteMethod('open', { http: { path: '/open', verb: 'post' }, accepts: [ { arg: 'exponente', type: 'string', required: true }, { arg: 'usuario', type: 'string', required: true } ], returs: { arg: 'chat', type: 'object' }, description: 'Find chat id of the document where you can send messages with exponent in the application.' });};
[...]
"charlas": { "dataSource": "observatoriotui", "public": true },
[...]
--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/0ea1e637-8fa8-4148-8aeb-2bf39e776a76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Anyway, i tried to return a simple object and have the same Response body "no content" and i don't know why, even i habe other model Charlas with the similar code and this return JSON data.