JavaXT
|
|
JavaXT ExpressThe javaxt-express library is used to help simplify the development of websites, data driven webservices, and responsive web applications. The library is lightweight and unopinionated. It consists of both Java and JavaScript classes that you can mix and match to suit whatever you need. Download javaxt-express
Current Version: 1.5.0
Release Date: 9/21/2024 File Size: 338 KB File Format: Zip Includes: Jar File and Source Code Key Features
Java DependenciesThe Java classes leverage several other JavaXT libraries including: Additional dependencies may be required, depending on how you are using javaxt-express. These optional dependencies include:
JavaScript DependenciesNone of the core Java components or comman line app require JavaScript. However, javaxt-express is bundled with several JavaScript classes that rely on the javaxt-webcontrols library.Java CompatibilityThe javaxt-express library is best used with Java 11 and up.Command Line InterfaceThe javaxt-express library is used to build custom web applications and is typically used as part of a larger system. However, it is compiled with a Main class that you can use to run a simple, standalone webserver to serve static files (e.g. html, css, images, etc), start a full-blown website backed by a content management system (CMS), or use as a persistence engine with a REST API. Note that you will need jars from a few related projects in order to run the command line app (see Java Dependencies section). Start Web ServerTo start javaxt-express as a webserver, run the following command. Be sure to pass a valid path to a directory (-dir). java -jar javaxt-express.jar -start webserver -dir /path/to/website Start CRUD ServerTo start javaxt-express as a persistence engine, run the following command. You will need to provide a model file like this one and a directory for where to store records. java -jar javaxt-express.jar -start webservices -models /project/model.js -database /project/dataOnce the server is up, you can create, update, delete, and view models using standard HTTP requests. For example, you can create a new Employee model using curl like this: curl -X POST http://localhost:8080/employee -d {"firstName":"Peter","lastName":"Jackson","fullName":"Pete Jackson"}If successful, the server will return an ID for the new record. You can see an individual record like this: curl http://localhost:8080/employee?id=1Or you can see multiple records like this: curl http://localhost:8080/employees?format=json Under the hood, the CRUD server is creating Java classes on-the-fly and storing the compiled classes in memory using the javaxt-orm library and it is and using a simple implementation of the javaxt.express.WebService class to respond to CRUD requests. You can see how this works in the "WebServices" servlet found in the javaxt.express.Server class. Maven SupportIf you're a Maven user, you can configure your pom.xml to pull releases directly from this site. To add javaxt-express to your project, simply add this site to your list of repositories and add a dependency. XML snippits below. See the downloads page for more information.Add Maven Repository
<repositories> <repository> <id>javaxt.com</id> <url>https://www.javaxt.com/maven</url> </repository> </repositories> Add Maven Dependency
<dependencies> <dependency> <groupId>javaxt</groupId> <artifactId>javaxt-express</artifactId> <version>1.5.0</version> </dependency> </dependencies> Add Runtime Dependencies
<!-- H2 dependency example --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>2.2.224</version> </dependency> DemosThere are a few demos available on GitHub. If you have git and maven, you can follow these quickstart instructions:git clone https://github.com/javaxt-project/javaxt-express-demo.git cd javaxt-express-demo mvn install java -jar dist/express-demo.jar -start cms -demo Basic |