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

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
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
wernerlaude
In AR this is so simple @articles = current_user.articles How to do in Ecto? def index(conn, _params) do current_user = conn.assig...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
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
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement