-
Notifications
You must be signed in to change notification settings - Fork 4
Getting Started
- Download "Web.API.Server.1.15.b4xtemplate" from Release (https://github.com/pyhoon/webapi-b4j/releases).
- Rename it to "Web API Server (1.15).b4xtemplate".
- Copy the "Web API Server (1.15).b4xtemplate" file into your B4J Additional Libraries folder.
This project template depends on following libraries (already included by default in B4J installation):
- ByteConverter
- JavaObject
- jServer (note that version 1.12+ is based on jServer 4.0)
- Json
- jSQL
The server configuration is set using config.ini file inside the Objects folder.
Lines starting with '#' are comments.
# SQLite
DbName=webapi.db
DbType=sqlite
DriverClass=com.sqlite.JdbcUrl
JdbcUrl=jdbc:sqlite:webapi.db
webapi.db is the sqlite database file that will be created and used to stored the application data.
In B4J project, make sure the line '#AdditionalJar: sqlite-jdbc-3.39.3.0' is uncomment.
Make sure you are using the correct version of SQLite library.
queries-sqlite.ini contains the SQL commands to create database schema and usage inside the application for Create-Read-Update-Delete (CRUD) operations.
# MySQL
DbName=webapi
DbType=mysql
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/webapi?characterEncoding=utf8&useSSL=false
User=root
Password=password
MaxPoolSize=100
webapi is the MySQL database name that will be created and used to stored the application data.
Update the database user (default=root) and password (default=password).
In B4J project, make sure the line '#AdditionalJar: mysql-connector-java-5.1.49-bin' is uncomment.
Make sure you are using the correct version of MySQL Connector library.
queries-mysql.ini contains the SQL commands to create database schema and usage inside the application for Create-Read-Update-Delete (CRUD) operations.
Contains the html files as template to generate the front-end
Contains the configuration files. SQLite database will be created here. If you compile the project as Release, the published jar will be generated here. There will be extra files for help generated for publishing the application in production. www folder is also keep inside this folder.
Contains the public accessible asset files such as css, img, js and webfonts. This template is using Bootstrap 4, Font Awesome 5 Free Solid and jQuery v3.4.0.
This project generates a compiled Java Archived (JAR) file which can be deployed to Windows or Linux server. You can upload the jar to your favourite virtual private server (VPS). You can use the nohup command to run the jar in a Linux server.
You can also setup secure connection using Let's Encrypt certificate and update the server port in config.ini settings.