How can I create blog api for my website?


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 ?

Those are queries. You need mutations to submit data, If I got what you meant.
i.e. GraphQL with Absinthe on Phoenix - Mutation

yes I want to hold blog data, but I will do it in where? for example for any kind of applications, you will hold data like image, title, body, video in where? how I will create blog api?

I will hold data on seeks.ex like that?

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?


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
1 Like

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.


ı understand now tnx so much :slight_smile:, can I hold data in postgress and fetch it?