KekKekington

KekKekington

Handling a POST request with Elixir

I finished setting up a static website using nginx. The site has a ‘Contact Us’ form that I enabled with one of those ready-to-go solutions. I saw an opportunity here to improve my understanding of web services, since I’ve always had a hard time understanding how to approach these problems, even if in theory I understand how they are supposed to work.
In short, the website will send a form to something like api.website.com as a POST request. Afterwards, Elixir should send that message to a specified email. I don’t know how to start handling this requests, I’d be happy if someone could point me in the right direction and maybe just mention which libraries I could use.
I know HTTPoison but afaik that is a client and not a server. Should I use cowboy?

Most Liked

lucaong

lucaong

If I understand correctly, you want to setup a server that receives the POST request from a form and sends you an email. Correct?

If that is what you need to do, and you want to give Elixir a shot, you could look into Plug for the HTTP server part, and mailman for sending email.

The most popular web application framework for Elixir is Phoenix, which is great, but probably overkill if you just want to handle this one single request, that’s why I am pointing you to Plug instead. If this is the starting point, but you want to do more, then give Phoenix a try, starting from one of the guides.

KekKekington

KekKekington

Thank you! Yeah I started learning Phoenix but decided to learn more about the language itself and OTP first. I think doing this will help me ease into web development. I will be using Plug and mailman as you suggested :slight_smile:

Where Next?

Popular in Questions Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> somethi...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement