code

code

Building an API

I want to transfer an API that was built using fastapi in python to elixir. Should I use phoenix or plug? Phoenix is excellent for web development, but is it overkill for an API that serves another frontend built in js? plug on the other hand seems suitable from what I’ve read but I also read that it needs more boilerplate. The API is fairly complex and plug seems suitable to me. I just wanted to know if there is anything that I should be warned about regarding plug and if there are some tweaks to phoenix to make it similar to fastapi (ie: remove the fullstack web development packages).

Thank you.

Marked As Solved

RudManusachi

RudManusachi

Take a look at the API-only applications section of Phoenix docs.

Also Liked

victorbjorklund

victorbjorklund

I would say go with Phoenix unless it is a very simple API that won’t grow in the future (which does not seem to be the case). The overhead of phoenix is negligible but makes many things easier.

Just exclude everything you don’t need:

mix phx.new my_api --no-assets --no-gettext --no-html --no-mailer

code

code

Thank you

dimitarvp

dimitarvp

Phoenix, while making your app have a little more files, is much more future-proof than any almost barebones Plug app you might do.

Go for Phoenix. It might be slightly annoying to begin with but will very quickly pay dividends.

Last Post!

victorbjorklund

victorbjorklund

I would say go with Phoenix unless it is a very simple API that won’t grow in the future (which does not seem to be the case). The overhead of phoenix is negligible but makes many things easier.

Just exclude everything you don’t need:

mix phx.new my_api --no-assets --no-gettext --no-html --no-mailer

Where Next?

Popular in Questions Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
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

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36689 110
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
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54996 245
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement