Git Product home page Git Product logo

commonsmh's Introduction

commonsMH - A superset for easy java tools and website developement

CodeFactor JitPack GitHub License

Table of Contents

  1. Database connection
  2. Flogger
  3. WebServer
  4. Router
  5. Route types
  6. RESTAPI route
  7. UploadHandler
  8. Authentication
  9. CacheTimers
  10. GETRequest
  11. Discord Webhook
  12. SitemapGenerator
  13. License

Database connection

Database database = new Database();
database.setDefaultSettings(); // Adds auto reconnect to mysql connections and cachePrepStmts
database.setMaximumPoolSize(30); // Sets the pool size
database.setConnectionTimeout(3000); // Set the timeout
// You will need to provide a own cfg before
database.connectToMySQL(CONFIG.getServerIp(), CONFIG.getMySQLUserName(), CONFIG.getMySQLPassword(), CONFIG.getMySQLDatabase(), ServerTimezone.UTC); // Connect the Instance to the Server

// You now can pull connections with:
MySQL myConnection = Database.getConnection(); // throws SQLException

myConnection.Query("SELECT * FROM `users` WHERE `id` = ?", 2); // prepStatements in one Line
myConnection.Exec("DELETE FROM `users` WHERE `id` = ?", 2);

// You will need to close this after you finish
myConnection.close();

// Many things in commonsMH will provide you with an connection that will automaticly close

License

This project is licensed under the MIT License.

commonsmh's People

Contributors

marcandreher avatar

Watchers

 avatar

commonsmh's Issues

Files are created instead of folders

image

java.io.IOException: templates is not a directory.
        at freemarker.cache.FileTemplateLoader$1.run(FileTemplateLoader.java:125)
        at freemarker.cache.FileTemplateLoader$1.run(FileTemplateLoader.java:119)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
        at freemarker.cache.FileTemplateLoader.<init>(FileTemplateLoader.java:119)
        at freemarker.cache.FileTemplateLoader.<init>(FileTemplateLoader.java:98)
        at freemarker.template.Configuration.setDirectoryForTemplateLoading(Configuration.java:1438)
        at commons.marcandreher.Commons.WebServer.runWebServer(WebServer.java:140)
        at commons.marcandreher.Commons.WebServer.ignite(WebServer.java:120)
        at dev.osunolimits.App.main(App.java:53)

Refactor webhook

Webhook embed creation is pretty hard with the current libary,

  • write a helper class

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.