Javascript (nodejs questions)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Javascript (nodejs questions)

sledorze
Hi,
1) playing with Node, I stumble around something I've always dodged using untyped __js__ ;
how to express this in haxe:

res.writeHead(200, {'Content-Type': 'text/plain'});

I can't generate an object with Content-Type as one of its identifier.

2) also, I wonder which IDE works best on Linux (guest); I've installed EcliHx but I really miss the compiler integration of FlashDevelop.

Stéphane

Reply | Threaded
Open this post in threaded view
|

Re: Javascript (nodejs questions)

Franco Ponticelli
1) playing with Node, I stumble around something I've always dodged using
untyped __js__ ;
how to express this in haxe:

res.writeHead(200, {'Content-Type': 'text/plain'});


+1 for this ... I've asked it before and I miss this feature very much.

Franco 


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Javascript (nodejs questions)

Dion Whitehead Amago
On Mon, Sep 5, 2011 at 12:07 PM, Franco Ponticelli
<[hidden email]> wrote:
>> 1) playing with Node, I stumble around something I've always dodged using
>> untyped __js__ ;
>> how to express this in haxe:
>>
>> res.writeHead(200, {'Content-Type': 'text/plain'});
>>

I use:

res.setHeader("Content-Type", "text/html");

Dion

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Javascript (nodejs questions)

Yanis Benson
In reply to this post by sledorze

You can't do that currently. String keys for objects are only a planned feature. You can do that using hash, but it's not very clean nor comfortable to do so. I'd recommend

res.addHeader('Content-Type', 'text/plain');
res.addHeader(..., ...);
res.writeHead(200);

or even

res
.header('Content-Type', 'text/plain')
.header(..., ...)
.writeHead(200);

For IDE I'd recommend Geany. It's fast, no stupid autocompletion(string based only) and you can write a simple she script to do whatever you want on run/build. But in one of the latest versions haXe syntax parser was broken so there was some problems with syntax highlighting with conditional compilation.

On 5 Sep 2011 20:53, "sledorze" <[hidden email]> wrote:
> Hi,
> 1) playing with Node, I stumble around something I've always dodged using
> untyped __js__ ;
> how to express this in haxe:
>
> res.writeHead(200, {'Content-Type': 'text/plain'});
>
> I can't generate an object with Content-Type as one of its identifier.
>
> 2) also, I wonder which IDE works best on Linux (guest); I've installed
> EcliHx but I really miss the compiler integration of FlashDevelop.
>
> Stéphane
>
>
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Javascript-nodejs-questions-tp6761350p6761350.html
> Sent from the Haxe mailing list archive at Nabble.com.
>
> --
> haXe - an open source web programming language
> http://haxe.org

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Javascript (nodejs questions)

Heinz Hölzer-2
In reply to this post by sledorze
var o = {};

Reflect.setField(o, "Content-Type", "text/plain");

should work.

Am 05.09.2011 18:51, schrieb sledorze:

> Hi,
> 1) playing with Node, I stumble around something I've always dodged using
> untyped __js__ ;
> how to express this in haxe:
>
> res.writeHead(200, {'Content-Type': 'text/plain'});
>
> I can't generate an object with Content-Type as one of its identifier.
>
> 2) also, I wonder which IDE works best on Linux (guest); I've installed
> EcliHx but I really miss the compiler integration of FlashDevelop.
>
> Stéphane
>
>
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/Javascript-nodejs-questions-tp6761350p6761350.html
> Sent from the Haxe mailing list archive at Nabble.com.
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Javascript (nodejs questions)

Franco Ponticelli
2011/9/5 Heinz Hölzer <[hidden email]>
var o = {};

Reflect.setField(o, "Content-Type", "text/plain");

should work.

It works but it is really clumsy and doesn't work well for config objects.

Franco 


--
haXe - an open source web programming language
http://haxe.org