简体   繁体   中英

How to synchronize posts in priv/static with database in an Elixir Phoenix blog?

I'm trying to implement a blog with Elixir and Phoenix. The posts are written in markdown, and the files are in priv/posts directory.

I succeed to implement this solution and it's working fine.

But i would like to add comments in my blog, so i have to store the posts in database and add a relation for the comments.

I don't know how to sync the files in priv with the database, i tried to run a function in a GenServer (where i retrieve all posts when server start) to check if a post already exist in database, by his slug, but it's not working.

Is there a good approach to sync the files with database? Or another solution to add comments?

You could also use a service like disqus for comments. They have a free tier.

(I don't have any experience with this service but maybe it works for you.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM