Giter Site home page Giter Site logo

bartholomews / keyaki Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.99 MB

JLPT SRS

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.34% Haskell 26.52% Elm 53.60% CSS 0.95% JavaScript 11.67% Shell 1.02% Dockerfile 2.93% Python 0.34% HTML 0.30% SCSS 2.34%

keyaki's Introduction

ケヤキ

Build Status Docker Pulls License: MIT

🔧 This project is still early stage and very much WIP / experimental 🔧

Haskell service

Seed from servant-persistent

Elm client

Look at the client package

Run the db

From within the project, you can start the db locally with:

docker-compose up

Alternatively, you can set up a docker network:

# Create a custom network if you want to use the app and db in docker without docker-compose
# (https://blog.linuxserver.io/2017/10/17/using-docker-networks-for-better-inter-container-communication/)
docker network create keyaki-network
docker run -p 5432:5432 \
    -e POSTGRES_USER=test \
    -e POSTGRES_PASSWORD=test \
    -e POSTGRES_DB=keyaki \
    --network=keyaki-network \
    --name=keyaki-postgres \
    postgres

Run the app from docker registry

docker pull bartholomews/keyaki
docker run -it -p 8081:8081 \
    -e PG_USER='test' \
    -e PG_PASSWORD='test' \
    -e PG_HOST='keyaki-postgres' \
    --network=keyaki-network \
    --name=keyaki \
    bartholomews/keyaki

If you want to change the port you need to add the PORT env var as well.

Development

  • Go to project folder
cd keyaki
  • Build project:
stack build

Please note that in order to build persistent-postgresql, you need to have pg_config in your PATH. Look at https://stackoverflow.com/questions/11618898/pg-config-executable-not-found if you have any issues.

  • Execute app
    (make sure you have built the client first)
stack exec keyaki
  • Live reloading w/ --file-watch:
./scripts/dev.sh
ghcid -c stack ghci -W -T main

Open http://localhost:8081

Run tests

stack build --test

Please note that you must have the following env vars defined:

  • KEYAKI_PG_HOST
  • KEYAKI_PG_PORT
  • KEYAKI_PG_USER
  • KEYAKI_PG_PASSWORD
  • KEYAKI_PG_DATABASE

Build a docker image locally

docker build -f docker/local/Dockerfile -t bartholomews/keyaki .

DB queries

by using httpie:

# add an entry
http POST localhost:8081/api/entry meaning="keyaki" kana="ケヤキ"

# get an entry
http :8081/api/entry/1

# get all entries
http :8081/api/entries

# update an entry
http PUT :8081/api/entry/1 meaning="keyaki" kana="ケヤキ" active:=true

# delete an entry (TODO)
http DELETE :8081/api/entry/1

Helpful Haskell / Servant stuff

keyaki's People

Contributors

bartholomews avatar

Watchers

 avatar  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.