Simple Web CRUD using Clojure and PostgreSQL
SQL:
CREATE DATABASE produto;
CREATE TABLE items (
id SERIAL PRIMARY KEY,
title VARCHAR(255),
description VARCHAR(255)
);
$ clone git@github.com:Ujs74wiop6/api-clojure.git
First of all, fill in your Postgres information
$ /api-clojure/src/crud/repository/migrations.clj
(def db {:dbtype ""
:dbname "produto"
:user ""
:password ""})
Downloading the dependencies
$ lein deps
Running the project
$ lein run
Creating the product:
curl -X POST localhost:3000/produto -H "Content-Type: application/json" -d '{"title":"Teste00", "description":"Teste00"}'
Listing all products:
curl -X GET localhost:3000/produto
Finding a product:
curl -X GET localhost:3000/produto/id
Updating a product:
curl -X PUT localhost:3000/produto/id -H "Content-Type: application/json" -d '{"title":"...", "description":"..."}'
Removing a product:
curl -X DELETE localhost:3000/produto/id
If you encounter any type of Authentication problem with your PostgreSQL: Link of StackoverFlow