Questions tagged [mochiweb]

MochiWeb is an Erlang library for building lightweight HTTP servers.

MochiWeb is an Erlang library for building lightweight HTTP servers.

Getting started

  1. Download mochiweb from official repository on GitHub.
  2. Watch Video Tutorial To Start Developing Web Applications on Erlang.
  3. Ask questions.

Community

There's a group of users of mochiweb on Google, where you can find other useful info and talk to its developers.

70 questions
18
votes
2 answers

Introduction to Erlang/OTP production applications deployment

I would like to develop and deploy an Erlang/OTP application into production on a VPS. I am pretty familiar with developing Erlang code on a local machine and my question is about deployment. Basically, I would like to know what steps I should take…
skanatek
  • 5,133
  • 3
  • 47
  • 75
14
votes
2 answers

When to use gen_server in Erlang/OTP applications

Having read Joe Armstrong's book and watched Kevin Smith screencasts I've built a simple OTP application comprised of a single gen_server and single supervisor, bundled together as an OTP application. Now I'm looking at mochiweb and have created a…
Justin
  • 4,649
  • 6
  • 33
  • 71
8
votes
1 answer

Erlang : Tuple List into JSON

I have a list of tuples which are http headers. I want to convert the list to a JSON object. I try mochijson2 but to no avail. So I have the following : [{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, …
Ben Ahlan
  • 497
  • 6
  • 9
7
votes
1 answer

mochijson2 or mochijson

I'm encoding some data using mochijson2. But I found that it behaves strange on strings as lists. Example: mochijson2:encode("foo"). [91,"102",44,"111",44,"111",93] Where "102", "111", "111" are $f, $o, $o encoded as strings 44 are commas and 91…
7
votes
2 answers

CouchDB as a part of an Erlang release

I would like to build and deploy an application which has Django as frontend, YAWS (appmods) or Mochiweb/Webmachine as a backend and CouchDB as a datastore. Furthermore, I plan to extensively use CouchDB's ability to replicate in order to provide…
skanatek
  • 5,133
  • 3
  • 47
  • 75
6
votes
3 answers

XForwardedSupport for https play! support on Heroku failing

I am deploying an app on Heroku and trying to determine whether the request coming in is secure (request.secure). This is initially returning false on heroku because nginx handles the SSL work and communicates over plain http to the app server. So…
Matt Hall
  • 2,569
  • 2
  • 23
  • 33
6
votes
4 answers

Getting started with mochiweb and Webmachine?

Mochiweb and webmachine are very promising applications when you see how those who have found they're way around them are using it. I need to be directed to where I can find beginners' tutorials on mochiweb. It appears there is no website dedicated…
Muzaaya Joshua
  • 7,736
  • 3
  • 47
  • 86
6
votes
3 answers

Detecting HTTP close using inet

In my mochiweb application, I am using a long held HTTP request. I wanted to detect when the connection with the user died, and I figured out how to do that by doing: Socket = Req:get(socket), inet:setopts(Socket, [{active, once}]), receive …
jeffreyveon
  • 13,400
  • 18
  • 79
  • 129
6
votes
3 answers

Where does Nitrogen get the best performance - yaws, mochiweb, or inets?

The Nitrogen project web page declares equal support for yaws, mochiweb, and inets, but with which of these web servers is it going to perform the best? I.e. for a large scale application with mostly dynamic content with nitrogen + a web server…
Jeremy Raymond
  • 5,817
  • 3
  • 31
  • 33
6
votes
2 answers

How to use mochijson to encode data structure in erlang?

I am using mochiweb and I don't know how to use its json encoder to deal with complex data structure. What's the differences between mochijson and mochijson2? Is there any good example? I always get the following errors: 46>…
Mickey Shine
  • 12,187
  • 25
  • 96
  • 148
5
votes
5 answers

Decode JSON with mochijson2 in Erlang

I have a var that has some JSON data: A = <<"{\"job\": {\"id\": \"1\"}}">>. Using mochijson2, I decode the data: Struct = mochijson2:decode(A). And now I have this: {struct,[{<<"job">>,{struct,[{<<"id">>,<<"1">>}]}}]} I am trying to read (for…
Jon Romero
  • 4,062
  • 6
  • 36
  • 34
5
votes
2 answers

Mochiweb Port 80

I am attempting to run BeepBeep through Mochiweb on Port 80. It works if I type sudo ./start_server.sh. Are there any security risks with running Mochiweb like this? If so how to remedy? Thanks!
ewindsor
  • 885
  • 10
  • 24
4
votes
1 answer

Running CouchDB with SSL stops working

I have a Couchapp running on a CouchDB instance. I have enabled SSL following the instructions on the Wiki http://wiki.apache.org/couchdb/How_to_enable_SSL using a signed certificate Entrust. I can access my application using SSL, however I keep…
Heather
  • 51
  • 4
4
votes
1 answer

Webmachine with http and https?

What is the recommended way of getting https working with webmachine? I see that there is an example for getting mochiweb working with https and http. I just can seem to translate that to webmachine. In particular how do you handle both http and…
noenzyme
  • 43
  • 5
4
votes
1 answer

JSON-encode a list using mochiweb

I need to JSON-encode a list using mochiweb. How do I get the following: List = ["This is message 1.", "This is message 2.", "This is the last message"] mochijson2:encode({struct,[{messages,list_to_binary(List)}] to produce this bit of…
MattM
  • 807
  • 3
  • 11
  • 20
1
2 3 4 5