Simple web server
This commit is contained in:
24
src/server/env.nim
Normal file
24
src/server/env.nim
Normal file
@@ -0,0 +1,24 @@
|
||||
import std/[
|
||||
mimetypes,
|
||||
os,
|
||||
]
|
||||
|
||||
const PORT_DEFAULT* = 1337
|
||||
const HTML_ROOT* = "../js"
|
||||
const DIST_ROOT* = HTML_ROOT.joinPath("dist")
|
||||
|
||||
type Env* = ref object
|
||||
port*: int
|
||||
mimeTypes*: MimeDb
|
||||
htmlRoot*: string
|
||||
distRoot*: string
|
||||
|
||||
proc initEnv*(): auto =
|
||||
Env(
|
||||
port: PORT_DEFAULT,
|
||||
mimeTypes: newMimetypes(),
|
||||
htmlRoot: HTML_ROOT,
|
||||
distRoot: DIST_ROOT,
|
||||
)
|
||||
|
||||
echo newMimetypes().getMimetype("txt")
|
||||
Reference in New Issue
Block a user