Code Monkey home page Code Monkey logo

schmervice's People

Contributors

afgallo avatar damusix avatar devinivy avatar mattboutet avatar nargonath avatar samueljoli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

schmervice's Issues

Call for v2 API improvements

I currently find schmervice's API pretty good, and I can't think of any breaking changes that I'd like to make to it for v2. But— what do you think? Please feel free to broach discussions about any aspects of the API that you find limiting or otherwise suboptimal, and we can create additional issues as necessary to finalize discussions or flesh-out proposals.

If there are no issues then that would be great news— of course I don't want to encourage API changes just for fun, but now is a good time to make changes, so if something has been on your mind then let's talk about it!

Peer @hapi/hapi needs update

Hello,

I was trying to update to hapi@21 today, and had an issue, noticed that schmervice peer dep range doesn't include 21

{
   "peerDependencies": {
    "@hapi/hapi": ">=19 <21"
  }
}

Pass parameters to service?

Is there a way to pass parameters to the service? Either to the constructor or the initialize-method? The options-object is just options internal to schmervice, right? Is my use-case for passing some initialisation options off base and the intent is to set dependencies/options on the context-object? At least that's how I've solved passing options to the service.

In my opinion it would make sense to pass in an options-object to the registerService(service, initOptions) that would be passed to the initialize() and/or constructor.

Usage with other plugins.

Hi @devinivy,

I am trying to use schmervice with another plugin. I have directory-based routing with wurst. https://github.com/felixheck/wurst

I register schmervice as

  await server.register(Schmervice);

    server.registerService(
        class MathService extends Schmervice.Service {
            add(x, y) {
                this.server.log(['math-service'], 'Adding');

                return Number(x) + Number(y);
            }

            multiply(x, y) {
                this.server.log(['math-service'], 'Multiplying');

                return Number(x) * Number(y);
            }
        }
    );


   await server.register({
        plugin: wurst,
        options: {
            routes: '**/routes.js',
            cwd: path.join(__dirname, 'lib/routes'),
            log: true
        }
    });

in a routes folder, when I look at request.services(). It is an empty object. How do I register Schmervice with another plugin so that I get access to the service in my route?

PS: sorry for the tag!

schmervice and typescript

Hello Im having a little trouble using Schmervice with typescript. I have imported @types for schmervice and I delare a class on a src/lib/services diresctory. i keep getting the error 'service must have a name' message meaning im not extending the base class properly. any initial guidance on setting up schmervice with typescript would be appreciated

Is there a way to stub a service for tests?

Hi!

I write integrational tests for my API server. Several services make requests to external servers like postgresql, redis etc. It's ok, but there is a service that makes requests to a server that I can't set up for each integrational test.

I tried to reinitialize the service like

server.registerService((server, options) => ({
  name: 'service_that_I_wanna_stub',
  stubbedMethod: () => {},
  anotherStubbedMethod: () => {}
});

But I got the error A service named service_that_I_wanna_stub has already been registered.

I have no idea how to solve my problem. Is there a way to make it work? Thank you.

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.