Closed bkawakami closed 9 years ago
Great glad you find it useful,
Yes wasabi is self hosting ( built on top of Netty ) you can change the port it binds to in the configuration, in your example just add 'server.configuration.port = somevalue' before starting Wasabi ( and Netty ) are designed to build self hosting event driven applications ( web in the case of wasabi ) , can you explain your intended use case a bit more?
Thank you for your response Dale
And sorry for my English, I am Brazilian.
I started programming with web languages like PHP, which work on Apache.
Apache has support for virtual host. For example, locally I could direct my http://localhost:3000 to http://mylocation.dev
This is possible with the Wasabi?
And again, this project is really amazing... When I get to be more experienced I will try to contribute!
Thanks for your attention!
Another question, how do I return JSON in default? The default is XML, I would switch to JSON
What do you need to do? Send back an object? As long as the serializers are configured (which by default JSON is), you just set the content type. Nothing more.
I try return a Hashmap, and by default I receive a XML:
server.get("/hello", {
var x = hashMapOf(Pair("a","b"),Pair("sada","bfds"),Pair("fda","bfv"))
response.send(x)
})
Return
<HashMap>
<fda>bfv</fda>
<sada>bfds</sada>
<a>b</a>
</HashMap>
What do you set as content type?
Regards, Hadi Hariri http://hadihariri.com | @hhariri
On 20 September 2015 at 21:50, Bruno Kawakami notifications@github.com wrote:
I try return a Hashmap, and by default I receive a XML:
server.get("/hello", { var x = hashMapOf(Pair("a","b"),Pair("sada","bfds"),Pair("fda","bfv")) response.send(x) })
Return
bfv bfds b— Reply to this email directly or view it on GitHub https://github.com/hhariri/wasabi/issues/25#issuecomment-141827138.
If you already have an apache instance setup to do virtualhosting you could just bind wasabi to an IP/Port on a machine within your network and add a entry like the below to your configuration.
<VirtualHost *:80>
ProxyPreserveHost On
ServerName http://mylocation.dev
ProxyPass / http://yourmachineIP:3000/
ProxyPassReverse / http://yourmachineIP:3000
</VirtualHost>
Doing the actual virtualhosting is not something which is easily done within wasabi/netty itself.
To further @hhariri 's comment wasabi by default handles serialization based on the Accept header the client sends in. In your case you would just want to set it to 'application/json' . You can also force response content sent in your route declaration as described here:
@swishy and @hhariri thanks for all... Everything work :)
You are the best!
I need say.. This project is amazing!
Well, when I compile my project with this:
I receive on my console:
It seems to me that the Wasabi has a built-in web server.
The default host is http://localhost:3000
How do I set up a virtual host with this built-in web server?