Clojure Luminus Web开发

Luminus

Luminus is a Clojure micro-framework based on a set of lightweight libraries. It aims to provide a robust, scalable, and easy to use platform. With Luminus you can focus on developing your app the way you want without any distractions.

Clojure有一些web框架,入门从luminus入手,开始做,然后你就会不断的升级,变更,定制你的框架。

命令行创建Hello,Clojure

$ lein new luminus hello-clojure

该命令生成模板工程,目录树如下

.
|____.gitignore
|____.lein-env
|____Capstanfile
|____Dockerfile
|____env
| |____dev
| | |____clj
| | | |____hello_clojure
| | | | |____dev_middleware.clj
| | | | |____env.clj
| | | |____user.clj
| | |____resources
| | | |____config.edn
| | | |____log4j.properties
| |____prod
| | |____clj
| | | |____hello_clojure
| | | | |____env.clj
| | |____resources
| | | |____config.edn
| | | |____log4j.properties
| |____test
| | |____resources
| | | |____config.edn
|____log
| |____hello-clojure.log
|____Procfile
|____profiles.clj
|____project.clj
|____README.md
|____resources
| |____docs
| | |____docs.md
| |____public
| | |____css
| | | |____screen.css
| | |____favicon.ico
| | |____img
| | |____js
| |____templates
| | |____about.html
| | |____base.html
| | |____error.html
| | |____home.html
|____src
| |____clj
| | |____hello_clojure
| | | |____config.clj
| | | |____core.clj
| | | |____handler.clj
| | | |____layout.clj
| | | |____middleware.clj
| | | |____routes
| | | | |____home.clj
|____test
| |____clj
| | |____hello_clojure
| | | |____test
| | | | |____handler.clj

启动该应用:

$ cd hello-clojure
$ lein run

Started server on port 3000

完整的启动日志如下


[2016-07-01 21:38:43,449][DEBUG][org.jboss.logging] Logging Provider: org.jboss.logging.Log4jLoggerProvider
[2016-07-01 21:38:43,925][INFO][hello-clojure.env] 
-=[hello-clojure started successfully using the development profile]=-
[2016-07-01 21:38:44,403][INFO][luminus.http-server] starting HTTP server on port 3000
[2016-07-01 21:38:44,513][INFO][org.xnio] XNIO version 3.4.0.Beta1
[2016-07-01 21:38:44,723][INFO][org.xnio.nio] XNIO NIO Implementation Version 3.4.0.Beta1
[2016-07-01 21:38:44,864][INFO][org.projectodd.wunderboss.web.Web] Registered web context /
[2016-07-01 21:38:44,865][INFO][luminus.repl-server] starting nREPL server on port 7000
[2016-07-01 21:38:44,889][INFO][hello-clojure.core] #'hello-clojure.config/env started
[2016-07-01 21:38:44,889][INFO][hello-clojure.core] #'hello-clojure.handler/init-app started
[2016-07-01 21:38:44,889][INFO][hello-clojure.core] #'hello-clojure.core/http-server started
[2016-07-01 21:38:44,889][INFO][hello-clojure.core] #'hello-clojure.core/repl-server started
[2016-07-01 21:38:44,889][INFO][hello-clojure.core] #'hello-clojure.core/log started

启动浏览器,访问: http://localhost:3000

你将看到如下页面:

关于Luminus详细的参考: http://www.luminusweb.net/

results matching ""

    No results matching ""