https://github.com/apsdehal/lein-clj-service
Lein template for a clojure service.
https://github.com/apsdehal/lein-clj-service
Last synced: 4 months ago
JSON representation
Lein template for a clojure service.
- Host: GitHub
- URL: https://github.com/apsdehal/lein-clj-service
- Owner: apsdehal
- License: apache-2.0
- Created: 2015-07-03T03:56:00.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-03T21:44:53.000Z (almost 11 years ago)
- Last Synced: 2024-12-31T08:25:52.512Z (over 1 year ago)
- Language: Clojure
- Size: 148 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lein Clojure Service
Leiningen template for a clojure based HTTP service. Following libraries are preincluded:
- [Ring](https://github.com/mmcgrana/ring)
- [Compojure](https://github.com/weavejester/compojure)
- [Compojure-API](https://github.com/metosin/compojure-api)
- [Ring-Swagger](https://github.com/metosin/ring-swagger)
## Usage
To create a new service, add the following to your lein `~/.lein/profiles.clj`
```clj
{:user {:plugins [[clj-service/lein-template "LATEST"]]}}
```
After this you can create the service with:
```
lein new clj-service
```
This will prompt for base path and port number of the service. Base path is where you main code will lie. For e.g passing `com/sdslabs` with name `lens` will create all code in `src/com/sdslabs/lens`.
Example:
```
lein new clj-service lens
```
Every service should have a unique port locally so that you can run more than one service locally.
## Service
Your service consists of three functions:
__initialize!__: Sets up the global state.
__Handler function__: Takes the request
__destroy__: Destroys global state.
## License
Distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)