A framework for real-time applications and REST APIs with JavaScript and TypeScript

Overview

Feathers logo

A framework for real-time applications and REST APIs with JavaScript and TypeScript

CI Maintainability Test Coverage Download Status

Slack Status Telegram Status

Feathers is a lightweight web-framework for creating real-time applications and REST APIs using JavaScript or TypeScript.

Feathers can interact with any backend technology, supports over a dozen databases and works with any frontend technology like React, VueJS, Angular, React Native, Android or iOS.

Getting started

You can build your first real-time and REST API in just 4 commands:

$ npm install -g @feathersjs/cli
$ mkdir my-new-app
$ cd my-new-app/
$ feathers generate app
$ npm start

To learn more about Feathers visit the website at feathersjs.com or jump right into the Feathers guides.

Documentation

The Feathers docs are loaded with awesome stuff and tell you every thing you need to know about using and configuring Feathers.

License

Copyright (c) 2021 Feathers contributors

Licensed under the MIT license.

Comments
  • TypeScript support

    TypeScript support

    IMPORTANT: Feathers 4 and later has built-in TypeScript support. Please see the docs for more information

    http://docs.feathersjs.com/frameworks/angular2.html Now the demo uses

    const feathers = require('feathers/client');
    const socketio = require('feathers-socketio/client');
    const io = require('socket.io-client');
    const localstorage = require('feathers-localstorage');
    const hooks = require('feathers-hooks');
    const rest = require('feathers-rest/client');
    const authentication = require('feathers-authentication/client');
    

    Please support TypeScript definitions to use import!

    TypeScript 
    opened by Hongbo-Miao 103
  • Asynchronous initialization of Feathers services

    Asynchronous initialization of Feathers services

    This is real issue that I've recently had, but I guess this concerns the framework in whole. I think that it is natural for Feathers services to be asynchronously initialized. They can pick their configuration from asynchronous sources, or it can be something else.

    In most cases synchronous application initialization is presumed, but I've encountered design problems when started using Sequelize.

    While Mongoose does some good job on accumulating promises inside for initialization actions (connection, index creation), so queries are automatically chained to initial promises, Sequelize does nothing like that, e.g. when sync() is called.

    I would expect that SQL database is ready at the moment when web server has been started, but when the application is defined in synchronous manner, it will not. And this is what happens with typical Feathers setup. In some cases async initialization may take several ms, in other cases it may take seconds, while the server will pollute logs with errors that should have been never happen normally.

    Another problem is error handling. If there are uncaught errors during async service initialization, the reasonable move would be to halt app initialization and catch errors in a single place.

    Here's a small example that explains the idea and is based on the structure proposed by Feathers generator template.

    app.js:

    const app = require('feathers')();
    
    // THIS!
    app.set('feathersServicePromises', []);
    
    app
    .use(require('body-parser').json())
    .configure(require('feathers-hooks'))
    .configure(require('feathers-rest'))
    .configure(require('./middleware'))
    .configure(require('./services'));
    
    // THIS!
    Promise.all(app.get('feathersServicePromises'))
    .then(() => app.listen(3000), console.error);
    

    services/index.js:

    module.exports = () => {
        const app = this;
    
        app
        .configure(require('./foo-async-service')
        .configure(require('./bar-async-service')
        .configure(require('./baz-sync-service')
    };
    

    services/foo-async-service.js:

    const sequelize = require('./common/sequelize');
    
    module.exports = () => {
        const app = this;
        const fooModel = sequelize.model('foo');
    
        // AND THIS!
        const initPromise = fooModel.sync();
        app.get('feathersServicePromises').push(initPromise);
    
        app.use('/foo', require('feathers-sequelize')({ Model: fooModel  }));
        app.service('/foo');
    };
    

    The places of interest here are initPromise and Promise.all(...). It would be convenient to just return initPromise from service function, like it is done in hooks. And Promise.all(...) could probably be lazily executed with app object toPromise() method or promise getter property. So it could be

    module.exports = () => {
        ...
        return fooModel.sync();
    };
    

    in service function, and

    app
    ...
    .configure(require('./services'))
    .promise
    .then(() => app.listen(3000), console.error);
    

    in entry point.

    I suppose that the pattern I've used for async initialization is already simple and clean, but it would be great if the framework would take this job.

    My suggestion is to place this feature under consideration.

    I would appreciate any thoughts on the subject.

    Feature Breaking Change Core 
    opened by bisubus 64
  • Please support GUI for CRUD

    Please support GUI for CRUD

    Right now we have full CRUD action for services but do not have GUI. It would be great if we have simple web application for user input. Maybe via tutorial or via code auto generator. Feather will be crazy seed for any project :dancer:

    Discussion Proposal 
    opened by takaaptech 57
  • Support $search in query syntax

    Support $search in query syntax

    I am consolidating all the individual issues and discussions here:

    This is a proposed special attribute that allows you to fuzzy match a property. Possibly even multiple properties and/or nested documents.

    Suggested syntax:

    name: {
      $search: ['alice', 'Alice', 'bo', /$bob/i]
    }
    

    Following similar syntax to our other special query filters, this would allow you to filter by a singular value, multiple values (treated like an or) and/or regular expressions directly.

    Service Adapter Completion

    • [ ] NeDB
    • [ ] MongoDB
    • [ ] Mongoose
    • [ ] Sequelize
    • [ ] Knex
    • [ ] Waterline
    • [ ] RethinkDB
    • [ ] Memory
    • [ ] Localstorage
    • [ ] LevelUp
    • [ ] Blob?? (maybe to support fuzzy matching filenames?)
    Feature 
    opened by daffl 35
  • Proposal: Switch to TypeScript for Development

    Proposal: Switch to TypeScript for Development

    IMPORTANT: Feathers 4 and later comes with built-in TypeScript support. Please see the docs for more information

    Propose switching to TypeScript

    In another thread, @marshallswain asked what the benefits are, and nobody really answered.

    TypeScript has already reached the StackOverflow volume of CoffeeScript and is getting close to the number of GitHub repos. I know that is subjective, but if you think about the relatively small amount of time TypeScript has been around it is pretty impressive. Someone asked above about the value TypeScript would provide the core team. Here are the benefits as I see them, even for JavaScript Unicorns.

    1. It is just sugar on top of JavaScript, so while it is a few extra keystrokes, you really won't notice much difference
    2. All of your existing ES2015+ knowledge moves over with you, you can use as much or little of the extra features as you want.
    3. You get a great amount of type safety for those extra keystrokes. Meaning it will tell you immediately if you are passing the wrong number or kind of parameters to a function. It might slow you down at the very beginning, but after a few days your velocity will actually be higher than before you used it, because you find a lot of mistakes before you even try to compile.
    4. If you write the code for this project in TypeScript, you get completely accurate declarations for the community for free. It's just a compiler switch at that point and where you want to output them. This will increase your user base greatly and will probably add some contributors as well. This brings Angular support with no extra effort. If you don't know already, Google mothballed AtScript and decided to write Angular 2+ in TypeScript.
    5. You can add TypeScript gradually, since TypeScript is just a super-set of JavaScript, every JavaScript file is TypeScript already, and the compiler will happily compile it along with TypeScript in most cases.
    6. This isn't just code completion, the compiler is statically analyzing your project for Type Errors the entire time. Every experience I have read about that has converted JS projects says it detected bugs they didn't even know they had.
    7. With projects like TypeDoc, you get very easy API documentation with types included, but not required.
    8. Consumers can still choose to use regular ES5 and should not even care that you wrote it in TypeScript.
    9. You can get features like unions, where you can say type switcher = "on" | "off" | "disabled", then you can say in your function changeLightStatus(newState: switcher), now if I try to pass "enabled" it will immediately complain that "enabled" is not a valid option and that I must specify "on", "off" or disabled. That is pretty awesome.
    10. You will make a lot of people happier than you already have with this amazing project, that I really want to use, but won't until there is proper TS support.

    To be clear, this isn't meant to be a "which is better" type of discussion. There is nothing wrong with the code you have, it is both beautiful and elegant. I am trying to make the case, that you will get a lot of added value for very little effort.

    I know this is bordering on a dead horse, I would just ask that you please do some research to see if it is a good fit for you and your team. There is a large group of us passing on this, because once you start using it, going back to being without it seems archaic. Again, there is nothing wrong with what you are doing now, that archaic feeling is only something you experience after using it for awhile. I am describing the feeling, not your code base or any other.

    I would definitely appreciate your careful consideration and I know myself and others in the community would be willing to help.

    Discussion Proposal 
    opened by mike-morr 31
  • How to fetch associations

    How to fetch associations

    So I have developed an app with the feathers framework. I have a hook attached to a database service that I want to access data from another service. Is this possible, and easy? I want that service to be able to access several neDB files. How do I do this?

    'use strict';
    
    module.exports = function(options) {
      return function(hook) {
    
        // access other db files here and get data
    
        hook.data = {
            putDataHere: newData
        };
      };
    };
    
    opened by MarcGodard 31
  • Uncaught (in promise) TypeError: Cannot convert undefined or null to object

    Uncaught (in promise) TypeError: Cannot convert undefined or null to object

    From @krthr on August 30, 2018 23:4

    Steps to reproduce

    • [ ] populateAccessToken functions isn't getting the accessToken token property.

    Expected behavior

    Login and create a new resource from the client.

    Actual behavior

    Login and getting and error when i try to create a new resource:

    Uncaught (in promise) TypeError: Cannot convert undefined or null to object
        at Function.assign (<anonymous>)
        at Object.eval (populate-access-token.js?39da:9)
        at promise.then.hookObject (hooks.js?8408:142)
    (anonymous) @ populate-access-token.js?39da:9
    promise.then.hookObject @ hooks.js?8408:142
    ...
    

    Module versions (especially the part that's not working):

    • "@feathersjs/authentication-client": "1.0.3"
    • "@feathersjs/feathers": "3.2.0"
    • "@feathersjs/socketio-client": "1.1.1"

    NodeJS version: 8.9.4 Operating System: Windows 10

    Copied from original issue: feathersjs/authentication-client#108

    Bug Authentication Client 
    opened by daffl 30
  • "No auth token" error on service calls

    Steps to reproduce

    I'm experiencing an issue where frequently when performing a service call an authenticated user will seemingly lose authentication for a second, causing the service call to fail. After that it looks like they are re-authenticated, but that one service call is lost. The server logs show a "No auth token" error on the before hook of whatever service was called when this occurs. At first I thought the problem was caused by calling other services within a hook and not passing the authentication params to them, but looking at the logs the server produces this error happens even when the only hook on the called service is authenticate('jwt').

    I'm not sure what the relevant code that could be causing this issue is. Here is what my authentication.js looks like:

    const authentication = require('@feathersjs/authentication');
    const jwt = require('@feathersjs/authentication-jwt');
    const local = require('@feathersjs/authentication-local');
    const PasswordValidator = require('password-validator');
    
    module.exports = function(app) {
      const config = app.get('authentication');
    
      // Setup password validator if a policy is defined
      if (config.passwordPolicy) {
        let validator
        app.getPasswordPolicy = function () {
          // Create on first access, should not be done outside a function because the app has not yet been correctly initialized
          if (validator) return validator
          let { minLength, maxLength, noSpaces } = config.passwordPolicy
    
          validator = new PasswordValidator()
          if (minLength) validator.is().min(minLength)
          if (maxLength) validator.is().max(maxLength)
          if (noSpaces) validator.not().spaces()
          
          return validator
        }
      }
    
      // Set up authentication with the secret
      app.configure(authentication(config));
      app.configure(jwt());
      app.configure(local());
    
      // The `authentication` service is used to create a JWT.
      // The before `create` hook registers strategies that can be used
      // to create a new valid JWT (e.g. local or oauth2)
      app.service('authentication').hooks({
        before: {
          create: [
            authentication.hooks.authenticate(config.strategies),
          ],
          remove: [authentication.hooks.authenticate('jwt')],
        },
        after: {
          create: [
            context => {
              //send data with auth response
              context.result.userId = context.params.user._id;
            }
          ]
        }
      });
    };
    

    Here is my channels.js:

    const logger = require('winston');
    
    module.exports = function(app) {
      if (typeof app.channel !== 'function') {
        // If no real-time functionality has been configured just return
        return;
      }
    
      app.on('connection', connection => {
        // On a new real-time connection, add it to the anonymous channel
        app.channel('anonymous').join(connection);
      });
    
      app.on('logout', connection => {
        //When logging out, leave all channels before joining anonymous channel
        app.channel(app.channels).leave(connection);
        app.channel('anonymous').join(connection);
        logger.log('info', 'logout');
      });
    
      app.on('login', (authResult, { connection }) => {
        // connection can be undefined if there is no
        // real-time connection, e.g. when logging in via REST
        if (connection) {
          // Obtain the logged in user from the connection
          const { user } = connection;
    
          // The connection is no longer anonymous, remove it
          app.channel('anonymous').leave(connection);
    
          // Add it to the authenticated user channel
          app.channel('authenticated').join(connection);
          logger.log('info', 'login');
    
          // User joins their own private channel
          //logger.log('info', typeof user._id === 'string')
          app.channel(`user/${user._id.toString()}`).join(connection);
    
          //if the user is a member of any chatrooms, join their channel
          app
            .service('rooms')
            .find({
              query: {
                $limit: 25,
                rmembers: {
                  $in: [user._id]
                }
              },
              user: user
            })
            .then(roomArray => {
              roomArray.data.forEach(room => {
                app.channel(`rooms/${room._id.toString()}`).join(connection);
              });
            });
        }
      });
    
      // When a user is removed, make all their connections leave every channel
      app.service('users').on('removed', user => {
        app.channel(app.channels).leave(connection => {
          return user._id === connection.user._id;
        });
      });
    
      // Publish user create events to all authenticated users
      app.service('users').publish('created', (data, context) => {
        return app.channel('authenticated');
      });
    
      // Publish user updated events to that user
      app.service('users').publish('updated', (data, context) => {
        return app.channel(`user/${data._id}`);
      });
    
      // Publish user patched events to that user
      app.service('users').publish('patched', (data, context) => {
        return app.channel(`user/${data._id}`);
      });
    
      // Publish all messages and rooms service events only to its room channel
      app.service('messages').publish((data, context) => {
        //logger.log('info', 'message sent');
        return app.channel(`rooms/${data.roomId}`);
      });
    
      app.service('rooms').publish((result, context) => {
        return app.channel(`rooms/${result._id}`);
      });
    
      //Publish challenge completion and power rewards to the required user
      app.service('user-challenges').publish((result, context) => {
        return app.channel(`user/${result.userId}`);
      });
    
      app.service('user-powers').publish((result, context) => {
        return app.channel(`user/${result.userId}`);
      });
    
      // Publish room-activity create events only to its room channel
      app.service('room-activity').publish('created', (data, context) => {
        return app.channel(`rooms/${data.roomId}`);
      });
    
      // Publish notifications to their recipients
      app.service('notifications').publish('created', (data, context) => {
        return context.data.map(user => {
          return app.channel(`user/${user}`);
        })
      });
    };
    

    Here is what I have on the client side in regards to authentication:

    this.socket = io(...); //set to ip address of server
    	this.app = feathers()
    		.configure(socketio(this.socket, { timeout: 10000 }))
    		.configure(
    			authentication({
    				storage: AsyncStorage
    			})
    		);
    
    ...
    
    login(username, password) {
    	this.app
    		.authenticate({
    			strategy: "local",
    			uname: username,
    			pword: password
    		})
    		.then(
    			action("authSuccess", user => {
    				// User is authenticated
    				this.isAuthenticated = true;
    				this.userId = user.userId;
    			})
    		)
    		.catch(error => alert(error.message));
    }
    

    If there's any other code you think may be causing the problem and you'd like to look at just let me know.

    Expected behavior

    The service call should complete successfully.

    Actual behavior

    The service call fails and returns a "No auth token" error.

    System configuration

    Module versions (especially the part that's not working): Server: @feathersjs/authentication: 2.1.5 @feathersjs/authentication-jwt: 2.0.1 @feathersjs/authentication-local: 1.2.1 @feathersjs/configuration: 1.0.2 @feathersjs/errors: 3.3.0 @feathersjs/express: 1.2.2 @feathersjs/feathers: 3.1.5 @feathersjs/socketio: 3.2.1 Client: @feathersjs/authentication-client: 1.0.2 @feathersjs/client: 3.4.5 @feathersjs/feathers: 3.1.5 @feathersjs/socketio-client: 1.1.0

    NodeJS version: 9.11.1

    React Native Version: 0.55.4

    Bug Authentication 
    opened by EliSadaka 30
  • iOS Client

    iOS Client

    A Feathers API is really easy to talk to. A native iOS client would be awesome and @corymsmith has done some prototyping here. It should behave similar to the Feathers client and feel familiar to people coming from the JS client. The things it should support:

    • Service communication over REST similar to feathers-rest/client
    • Service communication over Websockets similar to feathers-socket-commons/client
    • Authentication similar to feathers-authentication/client
      • An authenticate method that authenticates against the server and stores the JWT somewhere
      • A logout method that destroys the stored JWT
      • See docs for more info on the auth flow.
    • Hooks similar to feathers-hooks
      • Ability to register before and after hook chains to mutate data or query params

    feathers-client is a consolidation module for all the modules above. This is so that we can create a standalone bundle for people without JS module loaders. I don't think we need to do this for iOS. These client modules should all be bundled inside the one iOS client.

    We have a repository with some initial code set up for this if anyone wants to tackle it.

    Help Wanted 
    opened by ekryski 30
  • Feathers Schema: A common data model definition format

    Feathers Schema: A common data model definition format

    This issue consolidates the work from feathersjs/schema and the discussion from https://github.com/feathersjs/schema/issues/20 into an up to date proposal in the main repository since I think for now it makes the most sense to include the @feathersjs/schema here (with the option to turn it into a standalone module later once it has been used for a bit).

    Problem

    A very common problem we are seeing in web application development at the moment, especially in the NodeJS world, is that data model definitions are duplicated in many different places, be it ORM models, JSON schema validators, Swagger/OpenAPI specifications, TypeScript type definitions or GraphQL schemas. It is difficult to keep them synchronized and any new protocol or database is probably going to need the same work done again.

    You can find converters from almost any specific format to any other format on npm but there are many challenges from relying on a compilation step (generating duplicate code that doesn't really have to exist in the first place) to only covering a small subset of functionality. It also appeared a majority of those modules is no longer actively maintained. ORMs are trying to address the challenge by locking you into their way of doing things with database or ORM specific idiosynchrasies dictating how flexible you can be in defining your model.

    Feathers schema

    Feathers schema provides a common schema definition format for JavaScript and TypeScript that allows to target different formats like GraphQL, JSON schema (Swagger/OpenApi), SQL tables, validations and more with a single definition. Similar to how Feathers services allow different transport mechanisms to access their API without having to change your application code, schemas are Feathers answer to address the ever expanding list of data schema definition and validation formats.

    It does not only address the definition of data types but also how to resolve them within the context of your application. This is a different approach to most ORMs where you define your data model based on the database (or other ORM specific convention). Some examples where schemas are useful:

    • Ability to add read- and write permissions on the property level
    • Complex validations and type conversions
    • Shared model definition types between the client and server (when using TypeScript)
    • Associations and loader optimizations
    • Query string conversion, validation (no more type mismatches) and protections
    • Automatic API docs

    How it works

    @feathersjs/schema uses JSON schema as the main definition format with the addition of property resolvers. Resolvers are functions that are called with the application context and return the actual value of a property. This can be anything from the user associated to a message to the hashed password that should be stored in the database.

    Schema definitions

    import { schema } from '@feathersjs/schema';
    
    const UserSchema = schema({
      type: 'object',
      required: [ 'email', 'password' ],
      additionalProperties: false,
      properties: {
        id: { type: 'number' },
        email: { type: 'email' },
        password: {
          type: 'string',
          minLength: 8
        }
      }
    });
    
    const MessageSchema = schema({
      type: 'object',
      required: [ 'text' ],
      additionalProperties: false,
      properties: {
        id: { type: 'number' },
        userId: { type: 'number' },
        text: {
          type: 'string',
          maxLength: 400
        }
      }
    });
    
    // This defines a `data` schema (for `create`, `update` and `patch`)
    // based on UserSchema that hashes the password before putting it into the db
    const UserDataSchema = schema(UserSchema, {
      properties: {
        password: {
          resolve (password) {
            return hashPassword(password);
          }
        }
      }
    });
    
    // A new schema based on MessageSchema that includes the associated user
    const MessageResultSchema = schema(MessageSchema, {
      properties: {
        user: {
          resolve (value, message, context) {
            const { app, params } = context;
    
            return app.service('users').get(message.userId, params);
          }
        }
      }
    });
    

    TypeScript

    TypeScript types can be inferred from schema definitions. This is where to me TypeScript finally is starting to make real sense 😸 You get type definitions, dynamic validations and resolvers all in one place:

    import { schema, Infer } from '@feathersjs/schema';
    
    const UserSchema = schema({
      type: 'object',
      required: [ 'email', 'password' ],
      additionalProperties: false,
      properties: {
        id: { type: 'number' },
        email: { type: 'string' },
        password: {
          type: 'string',
          minLength: 8
        }
      }
    } as const);
    
    type User = Infer<typeof UserSchema>;
    
    const user = UserSchema.resolve({
      email: '[email protected]',
      password: 'supersecret'
    });
    

    Both the User type and user variable will have a type of the following interface:

    type User = {
      id?: number;
      email: string;
      password: string;
    }
    

    Using schemas with Feathers

    In a Feathers application schemas can be passed when registering a service via the options introduced in v5. Different schemas can be passed for validating data and params.query as well as resolving the result object returned to the client.

    import { feathers } from '@feathersjs/feathers';
    
    const app = feathers();
    
    // One schema for everything
    app.use('/messages', new MessageService(), {
      schema: MessageSchema
    });
    
    // Different schema for `result`, `data` and `query`
    app.use('/messages', new MessageService(), {
      schema: {
        result: MessageResultSchema,
        data: MessageDataSchema,
        query: MessageQuerySchema
      }
    });
    
    // With override for a specific method
    app.use('/messages', new MessageService(), {
      schema: {
        result: MessageResultSchema,
        data: MessageDataSchema,
        query: MessageQuerySchema,
        methods: {
          patch: {
            data: MessagePatchSchema
          }
        }
      }
    });
    

    Feedback wanted

    Development is currently happening in the schema branch and will eventually be moved to dove. I will start adding documentation in the Dove API docs section once a pre-release PR is ready. Many thanks already to the feedback to @DaddyWarbucks, @DesignByOnyx and @mrfrase3, please continue to challenge my assumptions if you see anything else that this proposal is missing 😄

    Feature Schema 
    opened by daffl 29
  • Unregistering services and hooks

    Unregistering services and hooks

    Currently, once the app is running, it's pretty difficult to unregister Feathers services and hooks.

    We would like to be able to support unregistering all event handlers associated with a route, so we can recreate and re-register them while the server keeps running. If we do this right, it will enable people to use hot reloading techniques such as Webpack's Hot Module Replacement with their Feathers services and hooks.

    API suggested by @daffl in Slack:

    app.service('/myservice',  null)
    

    would completely undo the effects of

    app.use('/myservice', myservice)
    

    ...and thus allow us to use HMR like this:

    services/myservice/index.js

    'use strict';
    
    let app; // hang on to the app object
    module.exports = function(){
      app = this;
      register()
    };
    
    function register() {
      // re-require on every invocation to facilitate HMR
      // `require` caches modules once loaded, so second require is fast.
      const hooks = require('./hooks');
      const Service = require('./service');
      app.use('/myservice', new Service());
      const service = app.service('/myservice');
      service.before(hooks.before);
      service.after(hooks.after);
    }
    
    function unregister() {
      app.service('/myservice', null);
    }
    
    if (module.hot) {
      module.hot.accept(['./hooks', './service'], function(){
        unregister(); // unregister the old service and hooks
        register(); // ..and register the new ones. 
      })
    }
    
    // not sure if it's useful to keep this next line...  modules referencing 
    // `Service` would need to make sure they get the new one somehow...
    // module.exports.Service = Service;
    
    opened by Download 29
  • Mysql database tables not created

    Mysql database tables not created

    I created application using CLI all good, but the tables are not created, I get the error from mysql that insert into table xxx is not exists.

    created new service using CLI also the table is not created, i used migration:make then I deleted the produced migration file. After that all the migration:make files are empty in both up and down functions.

    it is so sad to create the tables manually actually.

    opened by ahmedrhuma 0
  • V5 .env variables not present

    V5 .env variables not present

    Steps to reproduce

    I've looked in the new guides and the node_config but I can't find a solution (hopefully just a mis-read)

    I want to override the default.json with some variables from a .env file in the root of the project. So far i've had no luck i'm assuming the .env is not actually read? I've tried using the .env variable name as a value in both the default.json and custom-enviroment-variables.json but no joy the value never matches the .env file.

    My use case is replacing the port and host values with a .env file thats shared between docker setups as well as for local running.

    Expected behavior

    .env file to be used as an override for the node_config

    Actual behavior

    .env file values do NOT override the node_config

    System configuration

    V5 featherjs brand new generated project

    opened by k-flynn-webdev 0
  • docs: Fix a few typos

    docs: Fix a few typos

    There are small typos in:

    • docs/api/schema/typebox.md
    • docs/cookbook/authentication/revoke-jwt.md
    • docs/cookbook/general/client-test.md
    • docs/guides/cli/databases.md
    • docs/guides/whats-new.md

    Fixes:

    • Should read which rather than whicih.
    • Should read interactions rather than iteractions.
    • Should read illustrates rather than illustates.
    • Should read follows rather than folllows.
    • Should read committing rather than commiting.
    • Should read accessible rather than acessible.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 1
  • Additional AJV-formats crash app

    Additional AJV-formats crash app

    Following the Documentation for Additional Types and adding any of the 'additional' types (such as iso-date-time) to validators.ts, typescript complains that iso-date-time is not a valid option. Furthermore, using those types in a schema causes the app to crash.

    Steps to reproduce

    npx @feathersjs/cli@pre generate app accept all defaults Edit validators.ts by adding 'iso-date-time' to the list of formats (have to add //@ts-ignore for ts-node to not complain) Edit users.schema.ts to add an attribute createdAt: Type.String({ format: 'iso-date-time' }) Run yarn dev App Crashes

    Repro

    Looking at @feathersjs/schema it specifies [email protected], which looking at that version, iso-date-time is not included in that version. It is however included in [email protected] which their (ajv-formats) readme references.

    So as far as I can tell, the feathers documentation references some options for the release candidate ajv-formats package but that is not the package references in @feathersjs/schema's package.json.

    If I'm missing some step that I should have done to make this work then I apologize

    Expected behavior

    Should be able to enable that additional options in validators.ts that are shown in the documentation

    Actual behavior

    The app crashes with the message unknown format "iso-date-time" ignored in schema at path "#/properties/modules/items/properties/createdAt"

    System configuration

    Tell us about the applicable parts of your setup.

    Module versions (especially the part that's not working):

    "dependencies": {
        "@feathersjs/adapter-commons": "^5.0.0-pre.34",
        "@feathersjs/authentication": "^5.0.0-pre.34",
        "@feathersjs/authentication-client": "^5.0.0-pre.34",
        "@feathersjs/authentication-local": "^5.0.0-pre.34",
        "@feathersjs/authentication-oauth": "^5.0.0-pre.34",
        "@feathersjs/configuration": "^5.0.0-pre.34",
        "@feathersjs/errors": "^5.0.0-pre.34",
        "@feathersjs/feathers": "^5.0.0-pre.34",
        "@feathersjs/knex": "^5.0.0-pre.34",
        "@feathersjs/koa": "^5.0.0-pre.34",
        "@feathersjs/schema": "^5.0.0-pre.34",
        "@feathersjs/socketio": "^5.0.0-pre.34",
        "@feathersjs/transport-commons": "^5.0.0-pre.34",
        "@feathersjs/typebox": "^5.0.0-pre.34",
        "knex": "^2.3.0",
        "pg": "^8.8.0",
        "winston": "^3.8.2"
      },
    

    NodeJS version: 16.15.1 Operating System: OSX 12.6.1 Browser Version:

    React Native Version:

    Module Loader:

    opened by b-steel 0
  • How return file from service?

    How return file from service?

    Hi I need Link to download some file. This link is 'get' method in service. I'm try some hacks in service file:

    file.service.js

    const { File } = require('./file.class');
    const hooks = require('./file.hooks');
    
    module.exports = function (app) {
      const options = {};  
      
      // declare this before your services
      app.use(app.get('apiPrefix') + '/files', (req, res, next) => {
        // anything you put on 'req.feathers' will later be on 'data'
        req.feathers.req = req
        req.feathers.res = res
        next()
      })  
    
      app.use(app.get('apiPrefix') + '/files', new File(options, app));
    
      const service = app.service(app.get('apiPrefix') + '/files');
      service.hooks(hooks);
    };
    

    file.class.js

    const fs = require('fs')
    const path = require('path')
    const FMANAGERDIR = './public/'
    exports.File = class Files {
        async get(file, params) {
            try {
                let currentDirPath = FMANAGERDIR
                const res = params.res // define res objecti on service
                console.log('!!!', currentDirPath + '/' + file) // path to file is correct!
                const fileStream = fs.createReadStream(currentDirPath + '/' + file)
                res.header('Content-Disposition', `attachment; filename="${path.basename(file)}"`)
                res.header('Content-Type', 'application/octet-stream')
                return fileStream.pipe(res) //maybe it wrong
            } catch (error) {
                return error
            }
        }
    };
    

    But this not working, What is true way for resolve this task?

    opened by ruslan-gennadievich 0
Releases(v5.0.0-pre.34)
Owner
Feathers
A framework for real-time applications and web APIs
Feathers
Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.

Functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS. Ecosystem Name Description @marblejs/core F

Marble.js 2.1k Dec 16, 2022
Framework for setting up RESTful JSON APIs with NodeJS.

Restberry works with both Express and Restify! Framework for setting up RESTful JSON APIs with NodeJS. Define your models and setup CRUD API calls wit

Restberry 117 Jul 5, 2021
MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers

Derby The Derby MVC framework makes it easy to write realtime, collaborative applications that run in both Node.js and browsers. Derby includes a powe

DerbyJS 4.7k Dec 23, 2022
Use full ES2015+ features to develop Node.js applications, Support TypeScript.

ThinkJS Use full ES2015+ features to develop Node.js applications, Support TypeScript. 简体中文文档 Installation npm install -g think-cli Create Application

ThinkJS 5.3k Dec 30, 2022
Easily add filtering, sorting, and pagination to your Node.js REST API through your old friend: the query string!

QueryQL QueryQL makes it easy to add filtering, sorting, and pagination to your Node.js REST API through your old friend: the query string! Read our i

Truepic 99 Dec 27, 2022
The future of Node.js REST development

restify is a framework, utilizing connect style middleware for building REST APIs. For full details, see http://restify.com Follow restify on Usage Se

restify 10.6k Jan 2, 2023
Fake APIs for prototypes & automated tests.

Interfake is a tool which allows developers of client-side applications of any platform to easily create dummy HTTP APIs to develop against. Let's get started with a simple example.

Daniel Hough 805 Dec 23, 2022
LoopBack makes it easy to build modern API applications that require complex integrations.

LoopBack makes it easy to build modern applications that require complex integrations. Fast, small, powerful, extensible core Generate real APIs with

StrongLoop and IBM API Connect 4.4k Jan 4, 2023
Build Amazon Simple Queue Service (SQS) based applications without the boilerplate

sqs-consumer Build SQS-based applications without the boilerplate. Just define an async function that handles the SQS message processing. Installation

BBC 1.4k Dec 26, 2022
Simple scaffolding for applications that produce SQS messages

sqs-producer Enqueues messages onto a given SQS queue Installation npm install sqs-producer Usage const { Producer } = require('sqs-producer'); // c

BBC 160 Dec 23, 2022
A well documented set of tools for building node web applications.

Perk Framework Perk is a well documented set of tools for building node web applications. The goal of Perk is first and foremost to provide a well doc

Aaron Larner 179 Oct 26, 2022
🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈

Midway - 一个面向未来的云端一体 Node.js 框架 English | 简体中文 ?? 欢迎观看 Midway Serverless 2.0 发布会回放: https://www.bilibili.com/video/BV17A411T7Md 《Midway Serverless 发布

Midway.js 6.3k Jan 8, 2023
Fast and low overhead web framework, for Node.js

An efficient server implies a lower cost of the infrastructure, a better responsiveness under load and happy users. How can you efficiently handle the

Fastify 26k Jan 2, 2023
🚀 The Node.js Framework highly focused on developer ergonomics, stability and confidence

Sponsored by FOSS United is a non-profit foundation that aims at promoting and strengthening the Free and Open Source Software (FOSS) ecosystem in Ind

AdonisJS Framework 13.4k Dec 31, 2022
Catberry is an isomorphic framework for building universal front-end apps using components, Flux architecture and progressive rendering.

Catberry What the cat is that? Catberry was developed to help create "isomorphic/Universal" Web applications. Long story short, isomorphic/universal a

Catberry.js 801 Dec 20, 2022
The React Framework

Next.js Getting Started Visit https://nextjs.org/learn to get started with Next.js. Documentation Visit https://nextjs.org/docs to view the full docum

Vercel 98.6k Jan 5, 2023
Fast, unopinionated, minimalist web framework for node.

Fast, unopinionated, minimalist web framework for node. const express = require('express') const app = express() app.get('/', function (req, res) {

null 59.5k Jan 5, 2023
The Intuitive Vue Framework

Build your next Vue.js application with confidence using Nuxt: a framework making web development simple and powerful. Links ?? Documentation: https:/

Nuxt 41.8k Jan 9, 2023
Realtime MVC Framework for Node.js

Website Get Started Docs News Submit Issue Sails.js is a web framework that makes it easy to build custom, enterprise-grade Node.js apps. It is design

Balderdash 22.4k Dec 31, 2022