dartist / express

A thin express-js inspired layer around Dart's primitive HttpServer APIs
Other
126 stars 11 forks source link

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

Closed awalland closed 10 years ago

awalland commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

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

adracus commented 10 years ago

Was fixed, dart:convert is now used