bar65

bar65

How can I create blog api for my website?

screen:

I am new in elixir, so since one week I am try to build graphiql api with absinthe. I did not understand how I will create api like in screen, I want to create blog api for my website , but I do not know where I will create blog data, here an example tutorial, but I guess it old for new version, and it is not clear tutorial for junior like me. Any idea ?

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

I think this is not a good idea. If you are new to Elixir, you should take some time and learn Elixir fundamentals. Then you should learn some Phoenix and Ecto fundamentals. Only then should you try to take on Absinthe. Absinthe’s learning materials and books assumes you already know what you’re doing with Elixir, Phoenix and Ecto.

thelastinuit

thelastinuit

Ok, I think I misunderstood your question.
So, it depends on you. You can have a db to hold your data (Ecto as your lib to manage your db). From that, you can use the so called resolvers to retrieve that data or to save the data. Resolvers are called from queries or mutations.
In the end, the resolver is the one that provides the data back. It doesn’t matter from where really, that’s why it depends on you.

So, the question is: where do you want to save or keep your data? For example, if you have your data in a file within your code, it means that you will need to make a new release every time you update your data. However, if you access that file say from Amazon S3 to deliver the data, then your elixir release will be just to update your code. The same situation happens if you use a db.

Does that make sense?

al2o3cr

al2o3cr

Storing the data is unrelated to GraphQL - the article doesn’t mention it explicitly, but there are a few calls that look like context references:

  • Accounts.get_user_by_email
  • Accounts.list_users
  • Blog.update_post

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
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
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <%= ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
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
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
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
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

Other popular topics Top

Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
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
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
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