Building RESTful Web APIs with Dart, Aqueduct, and PostgreSQL — Part 1

Jermaine Oppong on May 05, 2018

PLEASE NOTE: As of Dart 2 the API for Aqueduct has changed, leading to breaking changes. This article was based on Aqueduct 2.5.0 for Dart v1.... [Read Full]
markdown guide
 

HI jermaine,

I had problem running "pub global activate aqueduct" i get this error

"%1 is not a valid Win32 application.

Command: C:\Program Files\Dart\dart-sdk\lib_internal\pub\asset\7zip\7za.exe e data.tar.gz

can you help resolve this error

 

Hi @faridak ,

Thanks for going through this tutorial series. I did some digging around and it appears to be a Windows related issue, caused when having spaces in your path, so "Program Files".

You can follow the recommended solution via that link, or even better install Dart through the Chocolatey package manager for Windows. It should be placed on a path without spaces.

Try and let me know how that turns out.

 

Hi Jermaine,

I did the install using Chocolatey, and this error remains.. I know it is a windows relates that the path is not defined .. but hot to set the Path so it can work... i am stuck in the installation.

Will appreciate if you can help, otherwise thank you.. .it frustrates me ..

The path is defined, its just that the Program Files folder has got spaces in it. It may be that the previous install of Dart is taking precedence over the Chocolatey install.

Can you confirm that running where dart in the command prompt is showing C:\tools\dart-sdk\bin\dart.exe? If its not happening then try these steps:

  1. Uninstall the earlier install of Dart, the one in C:\Program Files...
  2. Try adding C:\tools\dart-sdk\bin to your Path in Environment Variables.
  3. Run where dart to confirm the correct path is showing

Or you could just remove all installs of Dart, including Chocolatey's one and reinstall using Chocolatey. Should fix the path 🤞

 

August 12, 2018

As of Dart 2: I want to clarify things that needs to be changed.

router.route('/').listen((request) async {
  return new Response.ok('Hello world')
    ..contentType = ContentType.TEXT;
});

to

    router.route('/').linkFunction((router) async {
      return Response.ok("Hello World");
    });

Although I would like to point out many things, it's better to check out in their documentation because a lot of it are deprecated.

Have a great day!

 

Thanks Vince. Will do the rounds and make the edits soon.

 

Hi Jermain, nice article.

Dart is very very easy to set up :-) I'll be following along hoping to get some familiarity before checking out Flutter!

 

Hey Rhymes,

Thanks for the feedback. I'm very pleased that you found Dart easy to set up, since first impressions really count. Part 2 will be out this week and I intend on keeping myself accountable.

 
 

Nice article, I hope by the end of your series, I will understand RESTful Web APIs.

 

Hey Rameses, thanks for the feedback. This article assumes you have a general understanding of RESTful Web APIs. However, I hope you see how they can be applied in a real world scenario via the Dart platform.

 

I can't unable to create project using aqueduct create cmd, pls guide me how can I install on Windows.

 

Hi Arun, please see the updated video series on get started bit.ly/aqueduct-tutorial

Install Aqueduct on Windows by running pub global add aqueduct, assuming you've installed Dart already. See this lesson for details on installing Dart for Windows.

code of conduct - report abuse