Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"'dart:json' is not available on the stand-alone VM" when trying to run a very simple http server #12

Closed
awalland opened this issue Dec 1, 2013 · 4 comments

Comments

@awalland
Copy link

awalland commented Dec 1, 2013

hi!

library admonitus;

import "package:express/express.dart";

main(){
  var app = new Express()
    ..get('/admonitus/list', (ctx){
      throw new ArgumentError("custom error in handler");
    })
    .get("/admonitus", (HttpContext ctx){
      //lookup all
    })
    .get("/admonitus/:id", (HttpContext ctx){
      var id = ctx.params["id"];
      // loop up single row
    })
    ;
  app.listen('0.0.0.0', 8888);
}

i can build the code just fine but when i try to run it, here's what i get:

The built-in library 'dart:json' is not available on the stand-alone VM.
'package:express/express.dart': Error: line 4 pos 1: library handler failed
import "dart:json" as JSON;
^
'file:///home/armin/git/admonitus-rest/admonitusapi/bin/admonitusapi.dart': Error: line 3 pos 1: library handler failed
import "package:express/express.dart";
^

am i doing something wrong?

@sethladd
Copy link

sethladd commented Dec 1, 2013

dart:json is now a package, which you can get from http://pub.dartlang.org/packages/json However, you might be fine with the built-in JSON functionality here: https://api.dartlang.org/docs/channels/stable/latest/dart_convert.html#JSON

@awalland
Copy link
Author

awalland commented Dec 1, 2013

well, my code is not using json at all, so i thought, that express is at fault here. are you suggesting that i should just load the json package or that i should rather modify the express package?

@sethladd
Copy link

sethladd commented Dec 2, 2013

Sounds like you have to send a pull request to fix the express package.

@adracus
Copy link
Contributor

adracus commented May 11, 2014

Was fixed, dart:convert is now used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants