Hash :
a03e3d79
Author :
Thomas de Grivel
Date :
2024-09-10T22:42:14
The source files for the KC3 HTTPd web server are in /httpd
.
The web server depends on :
The web server must be started in a directory containing the following files :
./app/controllers/ # controllers directory (.kc3)
./app/templates/ # templates directory (.ekc3)
./app/views/ # views directory (.kc3)
./assets/ # assets directory
./assets/css/ # css directory
./assets/css/app.scss # application css, compiled to ./static/_assets/app.css
./assets/js/ # javascript directory
./assets/js/app.js # application javascript, compiled to ./static/_assets/app.js
./assets/node_modules/ # from npm
./config/routes.kc3 # dynamic routes
./static/ # for static files
./static/_assets/ # for static asset files
./static/_fonts/ # for static font files
./static/_images/ # for static image files
Run make test_httpd
to run the KC3 HTTPd web server (httpd/kc3_httpd
)
starting in the test/httpd
working directory.
This directory contains an example of configuring and using kc3_httpd
.
Static files are served from ./static and is mapped to root URL (/
).
Documentation in Markdown and HTML format is served from the /doc/
URL.
The documentation has a custom route defined in ./config/routes.kc3
,
a controller defined in ./app/controllers/doc_controller.kc3
and
a few templates defined in ./app/templates/doc/
.
The main layout for the application is stated in
./app/templates/layout.html.ekc3
and ./app/templates/nav.html.ekc3
.
Notice the .html.ekc3
extension, these are HTML files with embedded KC3.
See the EKC3 documentation for more information on these files.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
# 2 KC3 HTTPd web server
The source files for the KC3 HTTPd web server are in `/httpd`.
## 2.1 Dependencies
The web server depends on :
- KC3
- libkc3
- event
- socket
- http
- [SASS](https://sass-lang.com/) for CSS rendering
- [ESBuild](https://esbuild.github.io/) for Javascript rendering
## 2.2 Configuration
The web server must be started in a directory containing the following
files :
```
./app/controllers/ # controllers directory (.kc3)
./app/templates/ # templates directory (.ekc3)
./app/views/ # views directory (.kc3)
./assets/ # assets directory
./assets/css/ # css directory
./assets/css/app.scss # application css, compiled to ./static/_assets/app.css
./assets/js/ # javascript directory
./assets/js/app.js # application javascript, compiled to ./static/_assets/app.js
./assets/node_modules/ # from npm
./config/routes.kc3 # dynamic routes
./static/ # for static files
./static/_assets/ # for static asset files
./static/_fonts/ # for static font files
./static/_images/ # for static image files
```
## 2.3 Example
Run `make test_httpd` to run the KC3 HTTPd web server (`httpd/kc3_httpd`)
starting in the `test/httpd` working directory.
This directory contains an example of configuring and using `kc3_httpd`.
Static files are served from ./static and is mapped to root URL (`/`).
Documentation in Markdown and HTML format is served from the `/doc/` URL.
The documentation has a custom route defined in `./config/routes.kc3`,
a controller defined in `./app/controllers/doc_controller.kc3` and
a few templates defined in `./app/templates/doc/`.
The main layout for the application is stated in
`./app/templates/layout.html.ekc3` and `./app/templates/nav.html.ekc3`.
Notice the `.html.ekc3` extension, these are HTML files with embedded KC3.
See the [EKC3](/doc/EKC3) documentation for more information on these files.