This project displays one’s saved web bookmarks by category, for use by a REST client application. As distributed it provides access to a tiny sample of bookmarks, loaded from import.sql. The project uses Quarkus, "the Supersonic Subatomic Java Framework." Quarkus is a good way to build mini- and micro-services.
In production, a different application writes entries into a PostgreSQL relational database that this backend reads from (see https://github.com/IanDarwin/bookmark-swingui). And a third application displays lists for the user to review and open pages in the bookmarks. There’s a mobile version partly written, written in the Flutter cross-platform SDK.
You need a modern Java installed and on your PATH, and Apache Maven installed and on PATH.
Since I don’t want to commit the config files with my live configuration information, you have to copy a couple of files:
-
In src/main/resources, copy the file
application.properties.sample
toapplication.properties
-
In the same place, copy META-INF/persistence.xml.sample to META-INF/persistence.xml
-
If you miss or mess these steps you will get "no datasource" or "missing database table" messages!
-
Sample commands for Unix/Linux:
cd src/main/resources cp application.properties.sample application.properties cp META-INF/persistence.xml.sample META-INF/persistence.xml cd -
-
Use
make run
or just runmvn quarkus:dev
-
Open a browser to http://localhost:8080/.
-
Make sure all the demos work.
-
The POST demo isn’t on the web page; run the script
trypost
in a shell window.
To use a real database, make the obvious changes in the two files you copied,
application.properties
and src/main/resources/META-INF/persistence.xml
"Consider adding security?" No. Do it, before you go live with this, now that this API has some write modes (no longer read-only). See, for example, https://quarkus.io/guides/security-basic-authentication-tutorial.
To run tests, or package, you may have to use the mvnw
front-end to Maven.
See README-quarkus.md for details.
I did this already: ./mvnw quarkus:add-extension -Dextensions="container-image-docker"
To build for docker, try ./mvnw clean package -Dquarkus.container-image.build=true
A simplification layer for building microservices. Lots of tooling. Initial creation of this project, including a working "Hello, world" REST service, was created with just this:
mvn io.quarkus:quarkus-maven-plugin:1.12.1.Final:create \ -DprojectGroupId=com.darwinsys \ -DprojectArtifactId=bookmarks.backend \ -DclassName="com.darwinsys.quarkus.BookmarksResource" \ -Dpath="/hello" cd bookmarks.backend
If you want to learn more about Quarkus, most of the original README is in README.quarkus.md
If you want to build a project with more capabilities than are used here (lots are supported), visit
https://code.quarkus.io, check some boxes, and click Generate your application
.