Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
1a4ff6e5
Commit
1a4ff6e5
authored
10 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Basic boilerplate for Compojure/Ring HTTP server;
add some deps we will definitely want or need
parent
3b3a3866
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
project.clj
+28
-15
28 additions, 15 deletions
project.clj
src/metabase/core.clj
+17
-4
17 additions, 4 deletions
src/metabase/core.clj
with
47 additions
and
21 deletions
README.md
+
2
−
2
View file @
1a4ff6e5
...
...
@@ -8,9 +8,9 @@ Download from http://example.com/FIXME.
## Usage
FIXME: explanation
Run the HTTP server with
$ java -jar metabase-init-0.1.0-standalone.jar [args]
lein ring server
## Documentation
...
...
This diff is collapsed.
Click to expand it.
project.clj
+
28
−
15
View file @
1a4ff6e5
;; -*- comment-column: 60; -*-
(
defproject
metabase
"metabase-0.1.0-SNAPSHOT"
:description
"Metabase Community Edition"
:url
"http://metabase.com/"
...
...
@@ -5,25 +7,36 @@
:url
"http://www.eclipse.org/legal/epl-v10.html"
}
:min-lein-version
"2.0.0"
:dependencies
[[
org.clojure/clojure
"1.6.0"
]
[
expectations
"2.0.12"
]
; unit tests
[
marginalia
"0.7.1"
]
; for documentation
[
environ
"0.5.0"
]
; easy environment management
[
org.clojure/tools.logging
"0.3.1"
]
; logging framework
[
log4j/log4j
"1.2.17"
:exclusions
[
javax.mail/mail
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri
]]
[
com.h2database/h2
"1.3.170"
]
; embedded SQL database
[
korma
"0.4.0"
]
; SQL lib
[
org.clojure/core.async
"LATEST"
]
; facilities for async programming + communication (using 'LATEST' because this is an alpha library)
[
org.clojure/core.match
"0.3.0-alpha4"
]
; optimized pattern matching library for Clojure
[
org.clojure/data.json
"0.2.5"
]
; JSON parsing / generation
[
org.clojure/tools.logging
"0.3.1"
]
; logging framework
[
org.clojure/tools.macro
"0.1.2"
]
; tools for writing macros
[
com.cemerick/friend
"0.2.1"
]
; auth library
[
com.h2database/h2
"1.3.170"
]
; embedded SQL database
[
compojure
"1.3.1"
]
; HTTP Routing library built on Ring
[
environ
"0.5.0"
]
; easy environment management
[
expectations
"2.0.12"
]
; unit tests
[
korma
"0.4.0"
]
; SQL lib
[
log4j/log4j
"1.2.17"
:exclusions
[
javax.mail/mail
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri
]]
[
marginalia
"0.7.1"
]
; for documentation
[
ring/ring-json
"0.3.1"
]
; Ring middleware for reading/writing JSON automatically
[
swiss-arrows
"1.0.0"
]
; 'Magic wand' macro -<>, etc.
]
:plugins
[[
cider/cider-nrepl
"0.8.2"
]
; Interactive development w/ cider NREPL in Emacs
[
lein-environ
"0.5.0"
]
; easy access to environment variables
[
lein-expectations
"0.0.7"
]
; run unit tests with 'lein expectations'
[
lein-midje
"3.1.3"
]
; another unit testing option
[
lein-marginalia
"0.7.0"
]
; generate documentation with 'lein marg'
:plugins
[[
cider/cider-nrepl
"LATEST"
]
; Interactive development w/ cider NREPL in Emacs
[
lein-environ
"0.5.0"
]
; easy access to environment variables
[
lein-expectations
"0.0.7"
]
; run unit tests with 'lein expectations'
[
lein-midje
"3.1.3"
]
; another unit testing option
[
lein-marginalia
"LATEST"
]
; generate documentation with 'lein marg'
[
lein-ring
"0.8.10"
]
; start the HTTP server with 'lein ring server'
]
:main
^
:skip-aot
metabase.core
:target-path
"target/%s"
:ring
{
:handler
metabase.core/app
}
:profiles
{
:dev
{
:dependencies
[[
midje
"1.6.3"
]]
:jvm-opts
[
"-Dlogfile.path=target/log"
]}
:uberjar
{
:aot
:all
}})
This diff is collapsed.
Click to expand it.
src/metabase/core.clj
+
17
−
4
View file @
1a4ff6e5
(
ns
metabase.core
(
:gen-class
)
(
:require
[
clojure.tools.logging
:as
log
]))
(
:require
[
clojure.tools.logging
:as
log
]
[
compojure.core
:refer
[
context
defroutes
GET
]]
[
compojure.route
:as
route
]
[
ring.middleware.json
:refer
[
wrap-json-response
]]))
(
defn
-main
"I don't do a whole lot ... yet."
...
...
@@ -9,6 +12,16 @@
(
log/info
"testing logging"
))
(
defn
first-element
[
sequence
default
]
(
if
(
nil?
sequence
)
default
(
first
sequence
)))
\ No newline at end of file
(
or
(
first
sequence
)
default
))
(
defroutes
routes
(
GET
"/"
[]
"Success!"
)
(
GET
"/test.json"
[]
{
:status
200
:body
{
:message
"We can serialize JSON <3"
}})
(
route/not-found
"404 :/"
))
(
def
app
"The primary entry point to the HTTP server"
(
->
routes
wrap-json-response
; middleware to automatically serialize suitable objects as JSON in responses
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment