feathersjs

Arbitrary response content types in Feathers

十年热恋 提交于 2019-12-12 13:14:14
问题 I have a custom service that must return data in CSV format. I can't use a standard Express route, because I need Feathers' hooks on this endpoint. I couldn't find an example of a Feathers service returning non-HTML, non-JSON data, and have found no way to specify a response content type. Using res.set('Content-Type', 'text/csv') before returning from the service method didn't work; the final Content-Type header was reset to application/json , even though the method's return value was a

How upload image with feathersjs?

。_饼干妹妹 提交于 2019-12-12 10:20:58
问题 I have a for User Signup. I'm doing this: app.service('users').create( { email: this.state.Username, Nom: this.state.Name, Image: "../image/p.png", }) I am succeeded to add the user to the database. Now, I want to upload an image in the "image" folder and save its path in the attribute "Image". How can I do that? 回答1: There is a tutorial given in FeathersJS's official documentation to upload a file. You can follow this tutorial to upload your image file. However, you can upload your image

How to override feathersjs defaults service methods

旧时模样 提交于 2019-12-11 07:22:41
问题 I have a feathersjs service created using the feathers generate service command. I want to override its definition of create method. This is my service class /* eslint-disable no-unused-vars */ // Initializes the `userGroup` service on path `/usergroup` const createService = require('feathers-sequelize'); const createModel = require('../../models/user-group.model'); const hooks = require('./user-group.hooks'); const filters = require('./user-group.filters'); const async = require('async');

Aurelia using featherjs dependency failing to properly import

谁都会走 提交于 2019-12-11 06:25:22
问题 How do you import featherjs using the style common in Aurelia projects. This is what I have: in the build file aurelia.json "dependencies": [ { "name": "socket.io-client", "path": "../node_modules/socket.io-client/dist/socket.io.min" }, { "name": "feathers", "path": "../node_modules/feathers", "main": "client", "env": "dev" }, "aurelia-binding", In the app.js import io from 'socket.io-client'; import feathers from 'feathers'; //import socketio from 'feathers-socketio'; export class App {

How to run synchronous hooks on feathersjs

拥有回忆 提交于 2019-12-11 06:11:15
问题 I am trying to run two hooks synchronously on Feathersjs but the "addHost" function called by the statement "hook.service.find({ query: { active: '1' } }).then(page => page.data.forEach(addHost));" in the first hook is executing after the second hook. I need that all statements in hook1 finished before starting hook2. What I am doing wrong? thanks in advance! My code is the following: Hook1: module.exports = function (options = {}) { return function hook1 (hook) { hook.service.find({ query: {

Aurelia using featherjs dependency failing to properly import feathers-socketio

梦想与她 提交于 2019-12-11 02:37:03
问题 How do you import featherjs-socketio using the technique common in Aurelia projects. A previous question helped me past the second dependency, but the last one seems to have the same fate as the first without a similar workaround. Aurelia using featherjs depency failing to properly import This is what I have: in the build file aurelia.json "dependencies": [ { "name": "socket.io-client", "path": "../node_modules/socket.io-client/dist/socket.io.min" }, { "name": "feathers-client", "path": "..

Can feathers co exist with routs managed out side of feathers

倾然丶 夕夏残阳落幕 提交于 2019-12-11 02:23:10
问题 We have a large app which uses express for rest and primus for socket routes. It would be very hard to convert all to feathers at once. I am thinking of phased approach where I could take some routes and convert them to services and of cause any new routes will follow the service pattern. I will slowly migrate the rest of the app. The client is using primus and angularjs $http for now to communicate with nodejs. our current set up looks like var http = require('http'); var express = require(

Find nested array-object from rethinkdb in feathers JS

北城以北 提交于 2019-12-10 16:56:42
问题 I have a data set like follows- [{ "allowedusers": ["paul@abc.com"], "id": "1" },{ "allowedusers": ["kmahera@abc.com","rbajaniya@abc.com"], "id": "2" },{ "allowedusers": ["whatever@abc.com","rbajaniya@abc.com"], "id": "3" }] and I have a Query like this - http://localhost:3030/flowz$limit=5&allowedusers[$in[]=rbajaniya@abc.com&$skip=0&$select[]=id&$select[]=alloweduser . But I am not getting all the objects that contain rbajaniya@abc.com . How can I craft my query to get this. I want to get

Feathers.js / Sequelize -> Service with relations between two models

空扰寡人 提交于 2019-12-10 04:17:15
问题 I've got feathers.js functioning with mysql via sequelize. This is working, I can collect data from tables. Next step is to define 'joins' in the models. I have a table with a column 'status_id' and 'country_id'. These columns reference to an id in a metadata table. In SQL I would right: SELECT status.description, country.description, detail FROM details INNER JOIN metadata status ON (details.status_id = status.id AND status.type = 'status' INNER JOIN metadata country ON (details.country_id

How can I set the `sub` claim of a JWT in FeathersJS?

送分小仙女□ 提交于 2019-12-07 18:59:44
问题 The sub claim for JWTs is optional, but the feathersjs-authentication won't let me set it to a blank string or remove it. I was able to add a new value to the payload in the authentication before hook but changing sub or trying to remove it doesn't work. app.service('/api/auth').hooks({ before: { create: [ // You can chain multiple strategies auth.hooks.authenticate(['jwt', 'local']), hook => { // I can add a new `SUB` value but this method doesn't work for `sub` Object.assign(hook.params