@views

Configure the location of view code. Architect copies view code to all HTTP GET handler functions by default. You can also specify only the routes you want views copied to with the @views pragma.

Syntax

  • Routes should be existing @http routes.
  • Route names follow the same requirements as @http routes. see @http

Example

This app.arc file defines specific @http functions to copy src/views/ to:

arc
@app
myapp

@http
get /
get /kittens
get /dogs
get /raccoons

@views
get /kittens
get /raccoons
json
{
  "app": "myapp",
  "http": [
    [ "get", "/" ],
    [ "get", "/kittens" ],
    [ "get", "/dogs" ],
    [ "get", "/raccoons" ]
  ],
  "views": [
    [ "get", "/kittens" ],
    [ "get", "/raccoons" ]
  ]
}
toml
app="myapp"

http=[
  [ "get", "/" ],
  [ "get", "/kittens" ],
  [ "get", "/dogs" ],
  [ "get", "/raccoons" ]
]

views=[
  [ "get", "/kittens" ],
  [ "get", "/raccoons" ]
]

yaml
---
app: testapp

http:
- get: "/"
- get: "kittens"
- get: "dogs"
- get: "raccoons"

views:
- get: "kittens"
- get: "raccoons"