Skip to content

Htoonlin/MasterAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MasterAPI

This RESTful framework was developed by following:

So, you have to know about these frameworks and libraries. Getting Started

Version 3 Changelog

  • Upgrade maven libraries
  • Remove and Reduce
    • Remove SESSION management to prevent multi session creation
    • Remove JSP Web Page
    • Remove application path "api"
    • Generate upload directory ({basePath}/upload) if does not exist in setting (com.sdm.path.upload)
    • Remove GeoIPCache
    • Hide (Null/Empty) property in JSON Response
  • Change routeList path (sample/customers/route => /sample/customers/~info)
  • Auth allowed userName/email
  • Performance Improvement and Bug Fixed
  • Use Exceptions instead of MessageModel for ErrorMessages

3.1 Changelog

  • Changed JSP Template => Velocity Template

3.2 Changelog

  • Full Info for User AuditInfo
  • Support Firebase Cloud Messaging
MessageModel(204, "...") => throw new NullPointerException("...") 
MessageModel(400, "...") => throw new InvalidRequestException("...", "...", "...")

New Rest Resources

@Path("sample/customers")
public class CustomerResource extends RestResource<CustomerEntity, Integer> {
    public CustomerResource() {
        super();
    }
}

Getting started

Require properties to edit in hibernate.cfg.xml

Change database configuration at (line: 8-11)

<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/{your_db_schema}?zeroDateTimeBehavior=convertToNull&amp;useUnicode=true&amp;characterEncoding=UTF-8</property>
<property name="hibernate.connection.username">{your_db_user}</property>
<property name="hibernate.connection.password">{your_db_password}</property>
<property name="hibernate.default_schema">{your_db_schema}</property>

Require properties to edit in log4j.properties

Change Log directory name at (line: 15)

log4j.appender.fileAppender.File={your_log_directory}/sundew-api.log

Require properties to edit in setting.properties

Change directory for system at (line: 9, 10)

com.sdm.path={system_root_directory}
com.sdm.path.storage={file_upload_directory}

Change mail setting for system mail service at (line: 45-49). You can use your gmail account.

com.sdm.mail.host=smtp.gmail.com
com.sdm.mail.port=465
com.sdm.mail.is_auth=true
com.sdm.mail.user={your_gmail_account}
com.sdm.mail.password={your_gmail_password}

Ready for your API system now!


Package Structure

entity (Table Modeling)*

- Naming Standard
	- Property => camelCase
	- Class => {ObjectNameWithCamelCase}Entity

resource (Request/Response Manager)*

- Naming Standard
	- Class => {ResourceNameWithCamelCase}Resource

request (Request from Client Object)

- Naming Standard
	- Property => camelCase
	- Class => {ObjectNameWithCamelCase}Request

response (Response to Client Object)

  • Naming Standard
    • Property => camelCase
    • Class => {ObjectNameWithCamelCase}Response

util (Other Helper/Manager)

dao (Database Accessing Manager)

  • Naming Standard
    • Property => camelCase
    • Class => {ObjectNameWithCamelCase}DAO

DATABASE Standard

  • Table => tbl_{name_with_snake_case}
  • View => vw_{name_with_snake_case}
  • Procedure => proc_{name_with_snake_case}
  • User Columns => {nameWithCamelCase}