Newf is a new web framework for a new language, designed to make it as easy as possible to create high-performance website backends that can be deployed as a single executable.
Newf is presently Windows-only. But this is only because the server part is written using
Winsock, for now -- it'll be rewritten to use the cross-platform Socket
module, eventually.
Check the example out to see how it works:
git clone https://github.com/rezich/Newf.git
git clone https://github.com/rezich/SQLite.git # required for the example
cd Newf\examples\dorknews
jai dorknews.jai
.\bin\www
This will host the example website at localhost:8000.
Despite being a Modern Web Framework, Newf does not include anything like this! However, Newf pairs well with rezich/SQLite, and in fact was developed alongside it. If you want to use Newf to make a website with any kind of database functionality, it's highly recommended that you check it out -- the included example shows how easy it is to use.
In the future, SQLite may be required to use Newf, because it'll allow for better storage of user sessions, among other things.
Template files are just normal HTML files, but with "parse strings" surrounded by %{
and }
,
which are parsed and interpreted at compile time.
The most straightforward use of the template syntax, this is how you render dynamic content within your static HTML templates:
Render the member member
of the struct passed into Render()
(not yet implemented)
(not yet implemented)
Sometimes it's useful to compose templates from other templates. There's no need to worry about any runtime performance hit for doing this, because templates are baked into the executable at compile time!
Include the template named template_name
inside of this one
It's a pretty common situation: you have a struct member that's an array of something, and you want to render each item in the array with a template. This is where the delegated include syntax comes in handy.
Render each item in the array member member
of the struct passed in using the template_name
template
(not yet implemented)
(not yet implemented)
In addition to being able to access any member of the struct you pass to Render()
, you can also
access members of context.reqres.state
by using state.member
as the parameter name in your
template HTML.
- implement the not-yet-implemented template syntax items above
- store session data in a SQLite table instead of in memory
- session expiry; automatically remove expired sessions
- big cleanup in Server.jai
- caching on routes!
- improve HTTP request parsing & make it completely HTTP/1.0 compliant
- HTTP 1.1
- Linux support
- Gemini support
- some crazy experimental ideas for interactive tooling
- ...