1.0.16 • Published 5 years ago

node-package-assignment v1.0.16

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

node_module

a node module that determines the availability of a given list of servers and then returns an available server with the lowest priority number.

Alt text

example json

[
    {
        "url": "http://doesNotExist.boldtech.co",
        "priority": 1
    },
    {
        "url": "http://boldtech.co",
        "priority": 7
    },
    {
        "url": "http://offline.boldtech.co",
        "priority": 2
    },
    {
        "url": "http://google.com",
        "priority": 4
    }
]

Test the module

  • On the command line, create a new test directory by the following command
  • mkdir test-directory
  • Switch to the new directory:
  • cd /path/to/test-directory

In the test directory, install your module:

    npm install node-package-assignment
  • In the test directory, create a test.js file which requires your module and calls your module as a method, you can use the below code:
    // import created module
    const findServer = require('node-package-assignment');
    // this is our example json
    const data = require('./mock.data');

    // use the module to fetch lowest priority server
    const test = findServer(data);

    // response
    test.then((res) => console.log(res));
  • On the command line, run node test.js. The message sent to the console.log should appear something like this:

Alt text

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago