{"size": 1010, "ext": "scrbl", "max_stars_repo_path": "vela-doc/vela/app.scrbl", "max_stars_repo_name": "worktopia-io/vela", "max_stars_repo_stars_event_min_datetime": "2019-04-29T12:41:38.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-22T06:25:33.000Z", "max_issues_repo_path": "vela-doc/vela/app.scrbl", "max_issues_repo_name": "worktopia-io/vela", "max_issues_repo_issues_event_min_datetime": "2020-02-14T10:23:15.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-09T11:04:43.000Z", "max_forks_repo_path": "vela-doc/vela/app.scrbl", "max_forks_repo_name": "nuty/vela", "max_forks_repo_forks_event_min_datetime": "2020-04-09T06:47:23.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-25T10:33:06.000Z"}
{"max_stars_count": 48, "max_issues_count": 2, "max_forks_count": 3, "avg_line_length": 15.5384615385, "max_line_length": 65, "alphanum_fraction": 0.5930693069}
#lang scribble/manual
@title[#:style '(toc)]{Run App}


Vela provide a simple wrapper of (serve/servlet) call (run-app).

@defproc[#:link-target? #f
        (run-app 
        [routers urls?]
        [listen-ip "127.0.0.1"]
        [static-path path?]
        [static-url  string?]
        [log-file #f]
        [quit? #f])
        (serve/servlet)]

Here is an simple demo app.
@codeblock|{
#lang racket
(require
  vela/app
  vela/routes
  vela/dispatcher
  web-server/servlet-env)

(define index
  (lambda (req)
    (jsonify (hash 'msg "hello world!" ))))

(define routers
  (urls
    (url "/" index "index")))
}|

You can use (app-run) run it such like this
@codeblock|{
 
 ......

(app-run routers #:port 8000)

}|

Or if you want to use racket web-server internal (serve/servlet).

@codeblock|{

......


(define my-app 
  (lambda (req) 
    (dispatcher req routers)))

(serve/servlet
  my-app
  #:launch-browser? #f
  #:servlet-path "/"
  #:port 8000
  #:listen-ip "0.0.0.0"
  #:servlet-regexp #rx"")

}|

