Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eureka-js-connection

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eureka-js-connection - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

6

index.js

@@ -6,5 +6,7 @@ const axios = require('axios')

const defaultPort = process.env.EUREKA_PORT || 8761
const defaultEurekaUri = process.env.EUREKA_URI || `http://localhost`
const defaultEurekaUrl = process.env.EUREKA_URL || `${defaultEurekaUri}:${defaultPort}`
const getAllServices = (port = defaultPort) =>
axios.get(`http://localhost:${port}/`)
const getAllServices = (url = defaultEurekaUrl) =>
axios.get(url)
.then(prop('data'))

@@ -11,0 +13,0 @@ .then(html =>

{
"name": "eureka-js-connection",
"version": "0.0.3",
"version": "0.0.4",
"description": "Example using netflix eureka",

@@ -28,4 +28,5 @@ "main": "index.js",

"finalhandler": "^1.1.2",
"serve-static": "^1.14.1"
"serve-static": "^1.14.1",
"minimist": ">=1.2.2"
}
}

@@ -5,6 +5,7 @@ # Eureka-js-connection

# Usage
## With url
```js
const getAllServices = require('eureka-js-connection')
getAllServices()
getAllServices('http://localhost:8080')
.then(console.log)

@@ -14,3 +15,7 @@ .catch(console.error)

or with port
# Via environment variables
set en variables via cross-env
EUREKA_PORT || 8761
EUREKA_URI || 'http://localhost'
or EUREKA_URL || 'http://localhost:8080'

@@ -20,5 +25,6 @@ ```js

getAllServices(8761)
getAllServices()
.then(console.log)
.catch(console.error)
```

@@ -9,14 +9,17 @@ const test = require('ava')

http
.createServer((req, res) =>
serveStatic('./test')(
req, res, finalHandler(req, res)))
.listen(port)
test('getAllServices()', async t => {
const server = http
.createServer((req, res) =>
serveStatic('./test')(
req, res, finalHandler(req, res)))
.listen(port)
test('getAllServices', async t => {
const services = await getAllServices(8761)
const services = await getAllServices()
const services2 = await getAllServices(`http://localhost:${port}`)
console.log(services)
t.deepEqual(services, services2)
t.true(services[0].name.includes('a-bootiful-client'))
t.true(services[0].url.includes('8080'))
server.close()
})
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