New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hapi-axios

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-axios

a fun and lightweight integration between hapi and axios

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

hapi-axios

a fun and lightweight integration between hapi and axios

Dependencies

Hapi >= 17.5.3 Axios >= 0.18.0

Usage

  1. Installation
npm i hapi-axios
  1. Register
const Hapi = require('hapi');
const HapiAxios = require('hapi-axios');

const server = new Hapi.Server({
  host: 'localhost',
  port: 4000,
});

await server.register({
  plugin: HapiAxios,
  options: {
    instances: [
      {
        name: 'typicode',
        axios: {
          baseURL: 'https://jsonplaceholder.typicode.com',
          // you can use any axios config here. https://github.com/axios/axios#creating-an-instance
        },
      },
    ],
  },
});

await server.start();
  1. Usage
server.route({
  handler: async (request, h) => {
    const { typicode }  = request.server.plugins['hapi-axios'];
    const { data } = await typicode.get('users');
    // GET https://jsonplaceholder.typicode.com/users
    return h.response(data);
  },
  method: 'GET',
  path: '/users',
});

Keywords

FAQs

Package last updated on 09 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc