Skip to content

Commit

Permalink
added documenation for server
Browse files Browse the repository at this point in the history
  • Loading branch information
metamug2 committed Dec 4, 2022
1 parent 660393e commit 6267962
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 25 deletions.
40 changes: 34 additions & 6 deletions server/README.md
@@ -1,11 +1,39 @@
# mason-microservice
# Server

Run the maven project And point to the following url.
This a sample project build with embedded tomcat and uses mason tag library.
This can be deployed as a standalone jar in the microservices environment.

http://localhost:8080/rest/v1.0/execute
## Run
```
mvn compile exec:java -Dexec.mainClass=launch.Main
```

or try
## Examples

http://localhost:8080/rest/v1.0/movie
Run the maven project And point to the following url. The source code for these rest resources
are found in the [src/main/webapp/resources/v1.0/](server/src/main/webapp/resources/v1.0/)

For the sql to work you must update the db credentials in context.xml.
### Set Output values

```
http://localhost:3000/rest/v1.0/sample
```
### Object Marshalling

```
http://localhost:3000/rest/v1.0/execute
```
### SQL

```
http://localhost:3000/rest/v1.0/movie
```

For the sql to work you must update the db credentials in context.xml. Note the server loads much
faster if context.xml doesn't contain any datasource. As this library uses Hikari-cp

### Scripting

```
http://localhost:8082/rest/v1.0/logic
```
2 changes: 1 addition & 1 deletion server/pom.xml
Expand Up @@ -5,7 +5,7 @@
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>server</name>
<url>http://metamug.net</url>
<url>http://metamug.com/download/</url>
<properties>
<tomcat.version>9.0.43</tomcat.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/launch/Main.java
Expand Up @@ -24,7 +24,7 @@ public static void main(String[] args) throws Exception {
//Look for that variable and default to 8080 if it isn't there.
String webPort = System.getenv("PORT");
if (webPort == null || webPort.isEmpty()) {
webPort = "8082";
webPort = "3000";
}

tomcat.setPort(Integer.valueOf(webPort));
Expand Down
34 changes: 17 additions & 17 deletions server/src/main/webapp/META-INF/context.xml
Expand Up @@ -4,23 +4,23 @@
privileged="true"
reloadable="true" allowCasualMultipartParsing="true">

<Resource auth="Container"
closeMethod="close"
connectionTimeout="300000"
dataSource.implicitCachingEnabled="true"
driverClassName="com.mysql.cj.jdbc.Driver"
factory="com.zaxxer.hikari.HikariJNDIFactory"
idleTimeout="120000"
jdbcUrl="jdbc:mysql://server.metamug.net:3306/movieDB?useOldAliasMetadataBehavior=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=CONVERT_TO_NULL&amp;characterSetResults=UTF-8&amp;allowMultiQueries=true&amp;connectTimeout=120000"
maxLifetime="1800000"
maximumPoolSize="2"
minimumIdle="1"
name="jdbc/mason"
username="moviebuff"
password="password"
poolName="masonSamplePool"
type="javax.sql.DataSource"
/>
<!-- <Resource auth="Container"-->
<!-- closeMethod="close"-->
<!-- connectionTimeout="300000"-->
<!-- dataSource.implicitCachingEnabled="true"-->
<!-- driverClassName="com.mysql.cj.jdbc.Driver"-->
<!-- factory="com.zaxxer.hikari.HikariJNDIFactory"-->
<!-- idleTimeout="120000"-->
<!-- jdbcUrl="jdbc:mysql://server.metamug.net:3306/movieDB?useOldAliasMetadataBehavior=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=CONVERT_TO_NULL&amp;characterSetResults=UTF-8&amp;allowMultiQueries=true&amp;connectTimeout=120000"-->
<!-- maxLifetime="1800000"-->
<!-- maximumPoolSize="2"-->
<!-- minimumIdle="1"-->
<!-- name="jdbc/mason"-->
<!-- username="moviebuff"-->
<!-- password="password"-->
<!-- poolName="masonSamplePool"-->
<!-- type="javax.sql.DataSource"-->
<!-- />-->
<JarScanner scanManifest="false"/>
<WatchedResource>/WEB-INF/lib/</WatchedResource>
</Context>

0 comments on commit 6267962

Please sign in to comment.