zoukankan      html  css  js  c++  java
  • [play framework] Seperate the admin, and build it as a module in play framework

    I am a fresh man of java and play framework, maybe there is everyone know how to seperate the admin to a module, so please forgive me and help to build play framework better. :)

    Let use yabe for example.

    代码
    | |~yabe/
    | | |~app/
    | | | |~controllers/
    | | | | |-Admin.java*
    | | | | |-Application.java*
    | | | | |-Comments.java*
    | | | | |-Posts.java*
    | | | | |-Security.java*
    | | | | |-Tags.java*
    | | | | `-Users.java*
    | | | |+models/
    | | | |+views/
    | | | `-Bootstrap.java*

    In yabe, we can know that, the function of admin is developed in the root controllers, that is to say, CRUD is under the controllers, do you think that is not so convenience to manage the project?

    But thanks to play-framework, we can build a admin module in it.

    Here is the structure.

    | |~yabe/
    | | |~admin/
    | | | |+app/
    | | | |+conf/
    | | | `+public/
    | | |+app/
    | | |+conf/
    | | |+lib/
    | | |+logs/
    | | |+public/
    | | |+test/
    | | `+tmp/

    1. Create the module.
    Create a folder "admin" under the root, then you can just copy the folders (app, conf, public) to the admin

    2. Add a file "Admin.java", locate at /admin/app/controllers, we will use it as the default entry of the module.

    2. Add the code to the /conf/routes file

    GET /admin module:admin

    3. Modify the file /admin/conf/routs, remove all the code, and add the code as :

    GET / Admin.index

    Then start the project, and visit 127.0.0.1:9000/admin. Cool! The path of website is running well!

    Have fun with play-framework!

  • 相关阅读:
    Linux下安装JDK
    Flink源码阅读(五)——Flink中任务相关的核心类简析
    使用CloudFlare Worker 来免费部署 JSProxy 服务
    Nginx:进程调度
    Javassist基本用法汇总
    IO
    IO
    springcloud3(五) spring cloud gateway动态路由的四类实现方式
    架构设计(二) 互联网网关平台对比
    Python 的协程
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1837782.html
Copyright © 2011-2022 走看看