Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

dharrigan/startrek-clip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Star Trek Clojure/script Project

I would recommend that attention is given to the startrek project instead of this one.

The startrek project uses Donut instead of Clip. It’s also far more complete in handling errors, doing i18n, has tests showing how to mock ring requests and so on. Going forward, only the startrek project will be maintained.

Saying that, if you do want to continue to refer to this one (but bring in ideas found in the startrek project) by all means enjoy!

This is a very small, yet surprisingly complete, example of using Clojure to serve up a RESTful API. It uses a variety of technologies to demonstrate how this is possible. The project offers a full CRUD (Create, Read, Update and Delete) experience over some Star Trek starships!

  • CRUD Functionality

  • Exception Handling

  • Internationalisation (i18n)

  • Swagger API

  • Input Validation (using Malli)

This backend is written in Clojure and uses a PostgreSQL database to store a list of starships. The technologies in play include:

A full list of the technologies that are used can be found in the deps.edn file.

This service also exposes Prometheus metrics AND a JMX endpoint for your enjoyment!

A companion project is available on github that exposes a UI written in ClojureScript. It’s highly recommended that you look at that project too and see if you can get them both working together! 😀

There are at least 3 ways to launch this project:

You need to copy the resources/config/config-example.edn to resources/config/config-local.edn and modify, for example, if you are connecting to your own PostgreSQL instance.

Fire up a REPL and connect to it. Open up the main.clj file in your editor and evaluate the (do ,,,) block contained within the (comment ,,,) rich comment block.

You need to copy the resources/config/config-example.edn to resources/config/config-local.edn and modify, for example, if you are connecting to your own PostgreSQL instance.
  • bin/build

  • bin/run-local

You don’t need to copy any config file, as the docker container is configured to use config/config-example.edn, and thus this is the one by the application.
  • bin/build

  • bin/run-docker

Find the full unlicense in the UNLICENSE (and LICENSE) file, but here’s a snippet:

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

I welcome feedback. I can usually be found hanging out in the #clojure-uk channel on Clojurians Slack. You can also email me if you wish :-)

Live Long and Prosper!

About

No description, website, or topics provided.

Resources

License

Unlicense, Unlicense licenses found

Licenses found

Unlicense
LICENSE
Unlicense
UNLICENSE

Stars

Watchers

Forks

Packages

No packages published