InCorrect Path for Rest client in Haxe

71 Views Asked by At

I am a newbie to Haxe. I created the below code:

import restclient.RestClient;
/**
 * ...
 * @author Sriram
 */
class HaxeTest 
{
    static public function main() {
        trace("Hello, world!");
        var result = RestClient.get(
            "SOME_REST_GET_API");
        trace(result);
    }
    
}

I wanted to run the below command:

haxe --js main-javascript.js --main HaxeTest

But I get the below error:

HaxeTest.hx:1: characters 8-29 : Type not found : restclient.RestClient
HaxeTest.hx:10: characters 22-32 : Type not found : RestClient

I have installed the rest-client using haxelib install rest-client

Kindly assist.

1

There are 1 best solutions below

1
On

Installing a library doesn't directly mean it's used in compilation of the project. You should add -lib rest-client to actually tell the compiler that you want to use this library

haxe --js main-javascript.js --main HaxeTest -lib rest-client