1.0.16 • Published 4 years ago

node-package-assignment v1.0.16

Weekly downloads
1
License
ISC
Repository
-
Last release
4 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

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago