-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.rkt
More file actions
26 lines (23 loc) · 764 Bytes
/
Copy pathmain.rkt
File metadata and controls
26 lines (23 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#lang racket/base
(require "server.rkt"
"db.rkt"
racket/cmdline
web-server/servlet-env)
(define (serve [port 8888])
(displayln "Initializing database.")
(db-init)
(displayln (format "Running server on 0.0.0.0:~s" port))
(serve/servlet start
#:port port
#:servlet-regexp #rx""
#:command-line? #t))
(command-line #:program "web-server name"
#:usage-help
"Available commands:"
" serve: start server"
" db-reset: reset database"
#:args (cmd)
(case cmd
[("serve") (serve)]
[("db-reset") (db-reset)]
[else (printf "~s is not a command.\n" cmd)]))