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:
parent
05b1ce9e95
commit
c40209698c
15 changed files with 584 additions and 0 deletions
16
app/src/main/java/hello/App.java
Normal file
16
app/src/main/java/hello/App.java
Normal 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());
|
||||
}
|
||||
}
|
12
app/src/main/java/hello/AppUber.java
Normal file
12
app/src/main/java/hello/AppUber.java
Normal 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());
|
||||
}
|
||||
}
|
11
app/src/main/resources/templates/hello.html
Normal file
11
app/src/main/resources/templates/hello.html
Normal 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>
|
21
app/src/main/webapp/css/style.css
Normal file
21
app/src/main/webapp/css/style.css
Normal 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);
|
||||
}
|
18
app/src/test/java/hello/AppTest.java
Normal file
18
app/src/test/java/hello/AppTest.java
Normal 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"));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue