2
0
Fork 0
mirror of https://github.com/ethauvin/rife2-hello.git synced 2025-04-26 07:47:13 -07:00

Initial commit

This commit is contained in:
Geert Bevin 2023-02-12 11:39:35 -05:00
parent 05b1ce9e95
commit c40209698c
15 changed files with 584 additions and 0 deletions

View file

@ -0,0 +1,16 @@
package hello;
import rife.engine.*;
public class App extends Site {
public void setup() {
var hello = get("/hello", c -> c.print(c.template("hello")));
get("/", c -> c.redirect(hello));
}
public static void main(String[] args) {
new Server()
.staticResourceBase("src/main/webapp")
.start(new App());
}
}

View file

@ -0,0 +1,12 @@
package hello;
import rife.engine.Server;
import rife.engine.Site;
public class AppUber extends App {
public static void main(String[] args) {
new Server()
.staticUberJarResourceBase("webapp")
.start(new AppUber());
}
}

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><!--v title-->Hello<!--/v--></title>
<link rel="stylesheet" href="{{v webapp:rootUrl/}}css/style.css?{{v context:paramRandom/}}">
</head>
<body>
<p>Hello World</p>
</body>
</html>

View file

@ -0,0 +1,21 @@
:root {
/* fonts */
--main-font: sans-serif;
/* font sizes */
--main-font-size: 18px;
/* colors */
--main-background-color: #0d0d0d;
--main-text-color: #d0d0d0;
/* margins and padding */
--content-padding: 2em;
}
body {
background: var(--main-background-color);
font-family: var(--main-font);
font-style: var(--main-font-size);
color: var(--main-text-color);
padding: var(--content-padding);
}

View file

@ -0,0 +1,18 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package hello;
import org.junit.jupiter.api.Test;
import rife.test.MockConversation;
import static org.junit.jupiter.api.Assertions.*;
public class AppTest {
@Test
void verifyHello() {
var m = new MockConversation(new App());
assertEquals("Hello", m.doRequest("/hello")
.getTemplate().getValue("title"));
}
}