Fork me on GitHub
#pedestal
<
2017-05-17
>
v3ga02:05:50

does anyone here have any small apps such as a blog or forum written with pedestal? Preferably pedestal and component?

deg12:05:35

In my Vase app, after I define my schema, I'd like to populate it with some domain data. Can I do this directly in the service .edn file?

mtnygard13:05:52

@deg Yes, but be aware that Datomic doesn’t let you define attributes and use the attributes in the same transaction. Give me a minute and I can dig up a sample that does what you want.

mtnygard13:05:47

Here’s a bit that goes under :vase/norms in one of my apps

mtnygard13:05:48

{:control-server/clock
   {:vase.norm/txes [<#C49BSM9B3|vase>/schema-tx [[:clock/year            :one :long "4 digit year"]
                                      [:clock/month           :one :long "0 based month"]
                                      [:clock/day             :one :long "0 based day of month"]
                                      [:clock/hour            :one :long "0 based hour of day"]
                                      [:clock/minute          :one :long "0 based minute of hour"]]
                     [{:db/ident     :world-clock
                       :clock/year   2017
                       :clock/month  0
                       :clock/day    0
                       :clock/hour   0
                       :clock/minute 0}]]}

mtnygard13:05:03

@decim I’ve got this sample app https://github.com/mtnygard/todo-backend-pedestal. It doesn’t use Component, but there were some examples posted earlier yesterday that do.

mtnygard13:05:39

You can find 2 different libraries that use Component with Pedestal at http://pedestal.io/community/index

mtnygard13:05:53

(Component.Pedestal and Point Slope Elements)

deg13:05:14

@mtnygard Thanks! I thought I had tried that, as one of about half a dozen permutations. I must have mistyped something. Will try again now.

deg13:05:52

All good now. Thanks!

jfntn14:05:23

@kirill.salykin ended up using almost the same code, merging (component/depencies pedestal) in the context map which I like since it makes all deps accessible under their key

jimmy14:05:21

@decim are you still in need of an exmaple of pedestal and component. I will happily make @mtnygard example work with component if he accepts PR.

mtnygard14:05:11

@nxqd I’d be happy to take a PR.

mtnygard14:05:41

But I’d be even happier with another example so we have all the different styles represented.

jimmy14:05:24

We can start with an example that most beginner request. What do you think ?

mtnygard14:05:55

I’m not sure what you’re proposing

jimmy14:05:44

I haven't followed much these days, I meant I can start with pedestal + component first.

mtnygard14:05:16

Ah, OK. Sure!

ddeaguiar15:05:02

@nxqd we also have a guide for pedestal+component http://pedestal.io/guides/pedestal-with-component. What we’re missing is the follow up guide re: passing dependencies to interceptors and handlers. I think a sample demonstrating that would be great

ddeaguiar15:05:15

I’ve found that there are multiple approaches for this. One of the more popular ones being the approach demonstrated in @kirill.salykin’s gist https://gist.github.com/kirillsalykin/485403344bf85e5cb820ff4c91cdae0b

ddeaguiar15:05:43

which is very similar to Stuart Sierra’s component.pedestal approach

jimmy16:05:13

@ddeaguiar I see that we always have an example of using pedestal + component ( or like the one you posted above ) somewhere. However, it's not easy to find for beginner. So the better approach might be gathering those examples under pedestal repo ( under examples ) or a wiki page of external examples. What do you guys think ?

gerstree19:05:49

I need a little guidance on the use of vase. The documentation states "API-specific data that is persisted in the database is owned by that API". How should I interpret this. Is Vase at all suited to make existing data in an existing schema available as per REST API? Should other applications not touch this data anymore, thus requiring a redesign of let's say an existing web application?

mtnygard21:05:44

@gerstree That might be over-interpreting the statement. Since Datomic provides strong consistency, there shouldn’t be a problem accessing the data from a mixed API.

mtnygard21:05:47

If you have an existing schema, you can definitely use Vase to set up query and transaction routes against it. The only limitation is that it’s kind of hard to use transactor functions from Vase APIs, so if you need those to make atomic changes, you’ll have to write an interceptor by hand or use the #vase/interceptor syntax.

mtnygard21:05:57

@nxqd Re: pedestal + component examples… my preference would be a pull request on https://github.com/pedestal/pedestal-docs

mtnygard21:05:12

The “Community” page is meant for collecting that type of thing.