Coder Social home page Coder Social logo

Comments (1)

cahyowhy avatar cahyowhy commented on May 29, 2024

seems need to write custom adapter

// custom adapter so won't errror on windows
  const adapter = async (service: any, server: any, route: any) => {
    const url: string = path.join('/status', route.path).replace(/\\/g, '/');

    // 1. Expose given route in the `http` server application, here an example for the `Express.js`:
    // eslint-disable-next-line implicit-arrow-linebreak
    return server.get(url, async (req: any, res: any, next: any) => {
      try {
        // 2. Combine the `Express.js` route parameters:
        const params = { ...req.params, ...req.query, ...req.headers };
        // 3. Call given `route.handler` passing combined parameters and given service descriptor:
        const result = await route.handler(params, service);
        // 4. Decorate the `Express.js` response:
        res.status(result.status);
        res.set('Content-Type', result.contentType);
        res.set(result.headers);
        // 5. Return the response body according to given `contentType`:
        switch (result.contentType) {
          case 'application/json':
            res.json(result.body);
            break;
          default:
            res.send(result.body);
        }
      } catch (err) {
        // 6. Deal with the Error according to `Express.js` framework rules.
        next(err);
      }
    });
  };

the err seems on url path
const url: string = path.join('/status', route.path);

from node-healthchecks-api.

Related Issues (20)

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.