Code Monkey home page Code Monkey logo

ssa-clojure's Introduction

Clojure customers and employees web app with Bootstrap

Simple clojure web application for handling data from database. This web app is using basic CRUD operations (Create, Read, Update, Delete). It uses standard mysql jdbc connector for communicating with database which is hosted on localhost.

On the front-end, web app uses Bootstrap 3.3.5. and JQuery 3 libraries. All public html files are .mustache extension, because the easy way of binding data between controller.clj and html pages providing simple Logic-less template.

Sending data from server for mustache template with Clostache library:

(defn employees []
  (render-template "employees" {:employees (employees-model/allEmployees)
                                :offices (employees-model/allOffices)
                                }))

In this way you can use this variables in html pages with scriplets code : {{employees}} and {{offices}} and access to theirs attributes :

{{#employees}}
<tr class="success">
    <th>{{employeenumber}}</th>
    <th>{{firstname}} {{lastname}}</th>
    <th>{{email}}</th>
    <th>{{officecode}}</th>
    <td><a href="/model/employees/{{employeenumber}}/update" class="btn btn-info">Edit</a></td>
    <td><a href="/model/employees/{{employeenumber}}/remove" class="btn btn-danger">Remove</a></td>
</tr>
{{/employees}}

The app uses Ring and Compojure library for abstracting HTTP requests and response into a simple API to manipulate with GET, POST, PUT requests.

(POST "/model/employees/insert" [& params]
  (do (employee-model/insertE params)
    (resp/redirect "/employees")))
(POST "/model/employees/:employeeNumber/update" [& params]
(do (employee-model/update (:employeeNumber params) params)
(resp/redirect "/employees")))

Customers table : Alt text

Employees table : Alt text

Edit employee example : Alt text

Insert employee example : Alt text

A Clojure project @FON 2015

Usage

Use file classicmodels.sql in root folder and import it in mysql database.

Start web application using 'lein ring server' command.

License

Copyright © 2015 FIXME

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

ssa-clojure's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.