Bwf/ GuideFrançais

Search

  • Explore and modify the Journal

    Run the Journal shipped with Bwf. Follow a two-reader workflow through its views, controllers, PostgreSQL queries, and live updates.

  • Set up your first Bwf project

    Clone Bwf, create a small application called my-site, and change the heading on its home page.

  • Your first BSX page

    We’ll build a page you can open at localhost:8080. All it needs is a heading and a function to send that heading to the browser.

  • What the build checks

    Suppose we change the address of an article. How do we find the links that still point to the old address? We’ll use a link from the Journal to see which mistakes the build can catch.

  • Changing the article page

    Let’s make a small change to the Journal. We’ll add “Summary” under the title of each article. Open an article from the feed and keep it open so you can check your edit. The files we’ll use are in examples/canonical.

  • Route a request and link to it

    Let’s rename the home operation in the project you created during installation. Its URL will stay the same. The compiler will show us which names depend on the operation.

  • Controllers and typed responses

    We’ll start with a health check. When a client asks whether the Journal is running, our action only needs to send back the word “ok”.

  • Write a BSX view

    Let’s make a small badge we can use anywhere in the Journal. We’ll give it a label and use it in another view just as we would call a Bend function.

  • HTML forms and CSRF

    When you click Save in the Journal editor, the browser sends the field names along with what you typed. We’ll connect those names to the operation that handles the form.

  • Validation and error responses

    Try submitting three spaces as an article title. We’ll see where the Journal catches that mistake, then follow a registration error all the way back to its field in the form.

  • Serve JSON from an OpenAPI contract

    A client asks the Journal for JSON. What should the action return? We’ll start with the response in the OpenAPI file and construct a value of that shape in Bend.

  • Add a column to the Journal

    We’d like to give each article a short summary. There are already articles in the Journal, written before anyone thought to ask for a summary. Let’s add a column they can leave empty.

  • TypedSQL

    Let’s read a row from PostgreSQL in a Bend function. We can write the query next to the code that uses it and have the build check the fields we get back.

  • Relationships, joins and SQL projections

    An article card shows a headline and the name of the person who wrote it. Let’s fetch the two together and pass the result to the view.

  • Running two queries in one transaction

    In the example below, the first query returns an email address. The second counts the articles written by the account at that address. Follow the value called email from one query into the other.

  • Sessions and cookie context

    A visitor can read the Journal before they sign in. By the time they save an article, the action needs to know which account is writing. We’ll choose what each route receives.

  • Password authentication

    We’ll follow a Journal account from registration to its next sign-in. Along the way we’ll see what goes into the account table and how the controller starts a session.

  • Authorization and ownership

    Sign in to the Journal with a second account and open somebody else’s article. You can read it. What stops you from sending the editor’s request yourself?

  • Static assets

    Let’s add a file the browser can request on its own. We’ll put it under static/ and build its URL in a BSX view.

  • Typed translations

    We’ll ask the Journal for the same missing page twice. Watch the sign-in link in the navigation. The first request asks for English and the second for Canadian French.

  • HTMX and fragment responses

    Open the feed in a fresh tab, then click Next. The second page only needs a new list of articles. We’ll use the same URL whether the reader follows the link or pastes it into another tab.

  • Auto Refresh

    Open the same article in two sessions of the Journal. Leave a comment in one and watch the other. We’ll set up the subscription that lets the new comment appear in the open page.

  • Auto Refresh for HTMX fragments

    Click Next on the Journal feed and leave that page open. For new articles to appear there, Auto Refresh needs to know which slice of the feed you’re looking at.

  • Where the Next link comes from

    Look at LIMIT 11 in the query below. A page in the Journal only has room for ten articles. We’ll use the extra article to answer one question before we send the page to the browser.

  • Personalized lists and viewer state

    Open the same article in two accounts and mark it as a favorite in one. Both readers should see the same total, but only one should see the article marked as theirs.

  • Testing a Bwf application

    Before starting a server, we can already check the Journal’s routes, queries and views. Then we’ll make an HTTP request to check what a reader actually receives.

  • Build and deploy an application

    We’ll build the server and put its public files beside it. Once the service is running, we can make a health request to check the deployment.

  • Troubleshoot a Bwf application

    Keep the terminal running bwf dev in sight while you reproduce the problem. First we need to know whether the build stopped or the running server received a request.