Skip to content

Commit

Permalink
fix(docs): #61 Reflect usage of context function in home page (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlemaitre authored Feb 17, 2024
1 parent 2387afe commit ba6a282
Showing 1 changed file with 10 additions and 29 deletions.
39 changes: 10 additions & 29 deletions modules/docs/src/site/doc/landingpage.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,25 @@
import ... // import your dependencies

object app extends pillars.EntryPoint:
def app: pillars.App[IO] = new pillars.App[IO]: // define your app
def app: pillars.App[IO] = new: // define your app
def infos: AppInfo = BuildInfo.toAppInfo // automatic description from your build

def run(using p: Pillars[IO]): IO[Unit] = // enjoy!
import p.*
def run: Run[IO, IO[Unit]] = // enjoy!
for
_ <- logger.info(s"📚 Welcome to ${config.name}!")
_ <- Logger[IO].info(s"📚 Welcome to \${Config[IO].name}!")
_ <- flag"feature-1".whenEnabled:
DB[IO].use: session =>
for
date <- session.unique(sql"select now()".query(timestamptz))
_ <- logger.info(s"The current date is $date.")
yield ()
DB[IO].use: session =>
for
date <- session.unique(sql"select now()".query(timestamptz))
_ <- Logger[IO].info(s"The current date is \$date.")
yield ()
_ <- HttpClient[IO].get("https://pillars.rlemaitre.com"): response =>
logger.info(s"Response: ${response.status}")
_ <- apiServer.start(endpoints.all)
Logger[IO].info(s"Response: \${response.status}")
_ <- ApiServer[IO].start(endpoints.all)
yield ()
end for
end run
end app
object Main extends pillars.EntryPoint:
def app: pillars.App[IO] = new pillars.App[IO]:
def name = Name("BookStore")
def version = Version("0.0.1")
def description = Description("A simple bookstore")

def run(pillars: Pillars[IO]): IO[Unit] =
import pillars.*
for
_ <- logger.info(s"📚 Welcome to \${pillars.config.name}!")
_ <- pillars.whenEnabled(flag"feature-1"):
pillars.db.use: s =>
for
d <- s.unique(sql"select now()".query(timestamptz))
_ <- logger.info(s"The current date is \$d.")
yield ()
_ <- pillars.apiServer.start(endpoints.all)
yield ()
</code>
</pre>
</div>
Expand Down

0 comments on commit ba6a282

Please sign in to comment.