Skip to main content

Using winglibs

Wing libraries (winglibs) can be installed using the npm command line tool.

Here is an example of installing the redis winglib.

npm i @winglibs/redis

Then in your Wing source code, the library can be imported by name using a bring statement:

bring "@winglibs/redis" as redis;

new redis.Redis();

Libraries can expose the following kinds of API elements:

APIs in libraries can also be organized hierarchically for better organization. For example, a library may split up its API elements between multiple modules (also sometimes called "namespaces"):

bring "my-wing-payments-library" as payments;

new payments.charges.Charge();
new payments.customer.Customer();