32

Are we going to be able to use dart not only on the client/browser, but also on our server?

Write some code for a server e.g. Apache, accept browser requests, query a database and return a response to browser? Maybe create web services?


Edit: here is the link to a video where server side Dart is confirmed:

http://news.dartlang.org/2012/03/video-josh-bloch-talks-about-dart.html [min 36:00]

nbro
  • 15,395
  • 32
  • 113
  • 196
Gero
  • 12,993
  • 25
  • 65
  • 106

1 Answers1

26

Short answer yes.

Longer answer. The Dart VM already contains a HTTP chat server example that shows how to use the dart:io HTTP API to implement a web service. In general the dart:io library contains functionality that is meant to be used in server side programming such as sockets and file/directory handling.

Its still very early stage but already now you can play around with some early attempts of implementing connect/node style applications using the Dart SDK.

As for communicating between the client and the server you will have to use classic REST/HTTP mechanisms, but in the future (when reflection is implemented in Dart) you will be able to serialize actual Dart objects and thus share them between the client and server.

Lars Tackmann
  • 20,275
  • 13
  • 66
  • 83
  • 1
    yes, confirmed at 36:00 http://news.dartlang.org/2012/03/video-josh-bloch-talks-about-dart.html – Gero Mar 02 '12 at 23:12
  • 2
    I am not sure whether serialising Dart objects is a better way than REST. It's alright when it's all Dart from server to client. But, I believe it's not going to take off much because most web services are built to be consumed by multiple web clients including mobile clients and forcing them to talk Dart is not practical. – Salil May 23 '13 at 02:15
  • @Salil: I love the idea of the client and server sharing Dart objects and I think that it will take off. – OCDev Jul 08 '14 at 10:06