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

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
Kagamiiiii
Student & New to elixir. Nice language. I want to convert a english character, e.g. “a”, which is stored in a variable, to it’s asci...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
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
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New

Other popular topics 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
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
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
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
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
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

We're in Beta

About us Mission Statement