Initial support for static files
This commit is contained in:
		
							parent
							
								
									e40b453118
								
							
						
					
					
						commit
						bc2a428432
					
				|  | @ -1,4 +1,5 @@ | ||||||
| import prologue | import prologue | ||||||
|  | import prologue/middlewares/staticfile | ||||||
| import templating | import templating | ||||||
| 
 | 
 | ||||||
| proc getIndex*(ctx: Context) {.async.} = | proc getIndex*(ctx: Context) {.async.} = | ||||||
|  | @ -8,10 +9,11 @@ proc runWebsite(settings: Table) = | ||||||
|   let prologueSettings = newSettings( |   let prologueSettings = newSettings( | ||||||
|     debug = settings["debug"] |     debug = settings["debug"] | ||||||
|   ) |   ) | ||||||
|   let website = newApp(settings = prologueSettings) |   var website = newApp(settings = prologueSettings) | ||||||
| 
 | 
 | ||||||
|   website.get("/", getIndex) |   website.get("/", getIndex) | ||||||
| 
 | 
 | ||||||
|  |   website.use(staticFileMiddleware("static")) | ||||||
|   website.run() |   website.run() | ||||||
| 
 | 
 | ||||||
| export runWebsite | export runWebsite | ||||||
|  |  | ||||||
|  | @ -1,8 +1,11 @@ | ||||||
| <html> | <html> | ||||||
|   <head> |   <head> | ||||||
|     <title>Example</title> |     <title>Example</title> | ||||||
|  |     <style rel="stylesheet" href="/static/css/master.css"></style> | ||||||
|   </head> |   </head> | ||||||
|   <body> |   <body> | ||||||
|     {% block content %}{% endblock %} |     <div> | ||||||
|  |       {% block content %}{% endblock %} | ||||||
|  |     </div> | ||||||
|   </body> |   </body> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  |  /* Nothing here yet */ | ||||||
		Loading…
	
		Reference in New Issue