|
1 | 1 | <p align="center"><img src="https://raw.githubusercontent.com/JavaWebStack/docs/master/docs/assets/img/icon.svg" width="100"> |
2 | | - |
3 | | -# Web-Framework |
| 2 | +<br><br> |
| 3 | +JWS Object Relational Mapping |
| 4 | +</p> |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +## Introduction |
4 | 15 | The Web Framework combines multiple JavaWebStack libraries with glue code and helpers to allow fast web development |
5 | 16 |
|
6 | | - |
7 | | - |
8 | | -# Getting started |
9 | | -## Repository |
10 | | -### Maven (pom.xml) |
11 | | -```xml |
12 | | -<repositories> |
13 | | - <repository> |
14 | | - <id>javawebstack</id> |
15 | | - <url>https://repo.javawebstack.org</url> |
16 | | - </repository> |
17 | | -</repositories> |
18 | | - |
19 | | -<dependencies> |
20 | | - <dependency> |
21 | | - <groupId>org.javawebstack</groupId> |
22 | | - <artifactId>Web-Framework</artifactId> |
23 | | - <version>1.0-SNAPSHOT</version> |
24 | | - </dependency> |
25 | | - |
26 | | - <dependency> |
27 | | - <groupId>mysql</groupId> |
28 | | - <artifactId>mysql-connector-java</artifactId> |
29 | | - <version>8.0.22</version> |
30 | | - <scope>compile</scope> |
31 | | - </dependency> |
32 | | -</dependencies> |
33 | | -``` |
34 | | -`Build` [Buildscript for compilation with Maven](https://gist.github.com/JulianFun123/14b412245ecf0257c7819eb8dadc1438) |
35 | | - |
36 | | -## Usage |
37 | | -```java |
38 | | - |
39 | | -public class ExampleApplication extends WebApplication { |
40 | | - |
41 | | - protected void setupConfig(Config config) { |
42 | | - Map<String, String> map = new HashMap<>(); |
43 | | - // Maps a config entry with an key for .get("key") |
44 | | - map.put("EXAMPLE_KEY", "example.key"); |
45 | | - config.addEnvKeyMapping(map); |
46 | | - |
47 | | - // Registers .env as a configuration and adds System envs |
48 | | - config.addEnvFile(".env"); |
49 | | - |
50 | | - } |
51 | | - |
52 | | - protected void setupModels(SQL sql) throws ORMConfigurationException { |
53 | | - // The connection is going to be built by the credentials given in the config |
54 | | - |
55 | | - ORMConfig config = new ORMConfig().setTablePrefix("example_"); // .setDefaultSize(255) |
56 | | - // Registeres every Model in the Users package with the sql connection and ORMConfig |
57 | | - ORM.register(User.class.getPackage(), sql, config); |
58 | | - // Adds or updates the database structure |
59 | | - ORM.autoMigrate(); |
60 | | - } |
61 | | - |
62 | | - protected void setupServer(HTTPServer server) { |
63 | | - server.beforeInterceptor(exchange -> { |
64 | | - // Just an attrib example (Passes it through following routes & middlewares) |
65 | | - exchange.attrib("user", Repo.get(User.class).get(exchange.header("example-user-id"))); |
66 | | - // Do not intercept |
67 | | - return false; |
68 | | - }); |
69 | | - |
70 | | - // Adds every Controller in the package of ExampleController and extends HttpController (recursive) |
71 | | - server.controller(HttpController.class, ExampleController.class.getPackage()); |
72 | | - } |
73 | | - |
74 | | - |
75 | | -} |
76 | | - |
77 | | -``` |
78 | | - |
79 | | -```java |
80 | | -@PathPrefix("/user") |
81 | | -public class ExampleController extends HttpController { |
82 | | - @Get("/{id}") |
83 | | - public String getUser(Exchange exchange, @Attrib("user") User user) { |
84 | | - return user.name; |
85 | | - } |
86 | | -} |
87 | | -``` |
88 | | -```java |
89 | | -public class User extends Model { |
90 | | - @Column |
91 | | - public int id; |
92 | | - |
93 | | - @Column |
94 | | - public String name; |
95 | | -} |
96 | | -``` |
97 | | - |
98 | | - |
99 | | - |
100 | | -- Docs: https://javawebstack.org/framework/ |
101 | | -- Example Project https://github.com/javawebstack/ |
| 17 | +## Documentation |
| 18 | +You can find the current docs on our [website](https://docs.javawebstack.org/framework). This is a work-in-progress project though so it's not yet complete. |
102 | 19 |
|
103 | 20 | ## Community |
104 | 21 | ### JWS Modules |
105 | 22 | - [JWS-GraphQL](https://github.com/x7airworker/JWS-GraphQL) |
106 | 23 | ### Projects built with JWS |
| 24 | +- [InteraApps Passwords](https://github.com/interaapps/passwords-backend) |
0 commit comments