May 13, 2017
loopback-connector-db2ibmiis still pre-pre-alpha. Use with caution.
The commands above in order are simply:
$ lb # Follow configuration instructions. Above I choose default for each. $ npm install loopback-connector-db2ibmi --save
This will give us everything we need to begin making an API. To start with, let’s define our data source.
Defining a Data Source
At the moment, a data source will need to be created for each library. So, in
this case, think of a data source as a library, or schema, in the database.
Let’s first create the data source via
lb datasource, and then we’ll edit
the contents of
datasource.js once it the source has been generated.
All that needs to happen for now is to add a schema to the data source:
Now that we have a data source, we can create models to our heart’s content, and they’ll have CRUD + Querying out of the box.
Below is me defining a model via
lb model and filling out the configuration to
ECOMMERCE_USERS, which I made in my
Apigility Entity Mapper Tips
article. Tables, columns, etc. are all case sensitive. This is why you see me
yelling all my properties and such.
Don’t forget to define which column is the identity column. This is defined
That’s it! Now we have a nifty API out of the box to manipulate our data we just
defined with a model. Just start the server with
node ., and go to the address
in your browser to explore your API. Make sure to define the correct port in
project-dir/server/config.json. For example, the port I had to use for my
Litmis Space was
Below is me exploring the API at
didn’t do anything other than what I did above for these requests to work.
Contributions are more than welcome over at the loopback-connector-db2ibmi Github as it is very much in the beginning stages.