Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including apiconnect with all npm packages installed. Try it out:

apiconnect lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("apiconnect/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

apiconnect v5.0.25

IBM API Connect Developer Toolkit

Features

The API Connect Developer Toolkit provides a visual designer and a set of command-line tools for augmenting the local API create experience and to make it easy for developers to interact with API Connect clouds in Bluemix and on premises.

The toolkit includes the following features:

  • API Designer: A visual tool for creating, testing, and publishing APIs and applications.

  • API Explorer: A visual tool for exploring and testing APIs.

  • Loopback: A highly-extensible, open-source Node.js framework for quickly creating dynamic end-to-end REST APIs.

  • Micro Gateway: A gateway to support unit testing of policies to secure and enforce APIs as part of the local development experience.

  • The apic CLI: A set of commands to augment the local API create experience and for publishing APIs and applications to API Connect clouds in Bluemix and on premises.

Installation

$ npm install -g apiconnect

Preqrequisites:

  • Node.js version 0.12.0 or version 4.x.
  • On Windows, there are some additional prerequisites; see Installing the toolkit.

Getting Started

  1. Get help on the apic command set:

    $ apic -h
    
  2. Create a LoopBack application (take the defaults selecting hello-world which installs a sample application):

    $ apic loopback --name notes
    
  3. Change into the LoopBack application directory:

    $ cd notes
    
  4. Start the services for the local unit test environment:

    $ apic start
    
  5. Use curl to invoke the sample application to create a note and then list the notes. Scroll to the right to see the full command :

    curl -k -X POST https://localhost:4002/api/Notes -H 'X-IBM-Client-Id: default' -H 'X-IBM-Client-Secret: SECRET' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{ "title": "This is my first note" }' -v
    curl -k https://localhost:4002/api/Notes -H 'X-IBM-Client-Id: default' -H 'X-IBM-Client-Secret: SECRET'
    
  6. Start the API Designer and explore the application:

    $ apic edit
    

Additional Resources

Dev notes

Logger

// A logger that captures all of the output from running a command. Used specifically for testing // Set env variable CAPTURING_LOGGER export CAPTURING_LOGGER=true // In the test code use the following logger var logger = require('apiconnect-cli-logger');

Running tests (for a repo)

  • If the tests use the functionality of the logger e.g. to capture the output of a command and then compare it to some expected value, you will need to use the logger mentioned above and set the CAPTURING_LOGGER environment variable.
  • If the tests require a stack or logger (mentioned above): Note: npm test should pass no matter what.
    • npm test would just pass without running any tests. Otherwise the job that promotes the node module to the CI registry would fail.
    • npm run server-test would run the tests. You need to set APIM_MANAGEMENT, APIM_USERNAME and APIM_PASSWORD
      environment variables locally. For the CI, the jenkins job will fail immediately. You will need to Right click on the jenkins job "continuous-integration/jenkins/pr-merge", on the top Right hand corner click on "Go to classic" button, on the top left section, go one level up, by clicking on the PR (currently at the build level) to go to the PR level. Click on "Build with Parameters", provide the needed values. Click on "Build" button.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free