Giter VIP home page Giter VIP logo

Comments (10)

swlkr avatar swlkr commented on June 14, 2024

Hm what happens when you run it with the DATABASE_URL environment variable set?

DATABASE_URL=path-to-your-db.sqlite3 joy server

from joy.

kwccoin avatar kwccoin commented on June 14, 2024

Try it and get pass the stage where joy sever can be started

joy server Server listening on [localhost:8000] ... [2020-05-03 05:24:59] at=info msg="Started GET /" method=GET url=/ [2020-05-03 05:24:59] at=info msg="Finished GET /" method=GET url=/ status=200 duration=0.0026ms content-type=text/html [2020-05-03 05:24:59] at=info msg="Started GET /favicon.ico" method=GET url=/favicon.ico

But the database seems not sure. I did something but obvious have problem.

' joy create table account 'email text not null uniqu 'password text not null''

create those directory and files i.e.

'ls db/migrations/
20200503052212-create-table-account.sql'

But

'joy migrate
error: file is not a database
in sqlite3/eval
in execute [/usr/local/Cellar/janet/1.8.1/lib/janet/db/sqlite/db.janet] on line 90, column 5
in [/usr/local/Cellar/janet/1.8.1/lib/janet/db/migrator.janet] on line 105, column 5
in migrate [/usr/local/Cellar/janet/1.8.1/lib/janet/db/migrator.janet] (tailcall) on line 104, column 3'

I drop the db and create the db again; then I remember there is this message that appear again:

joy create db error: bad slot #0, expected core/file, got nil in file/close in create-file [/usr/local/Cellar/janet/1.8.1/lib/janet/joy/helper.janet] (tailcall) on line 143, column 3

Not sure how to move on.

from joy.

kwccoin avatar kwccoin commented on June 14, 2024

Just in case, may I ask seem you seems to know janet well -- is all these can be done in an embedded environment like picolisp (which I like but only run under certain env.)

from joy.

kwccoin avatar kwccoin commented on June 14, 2024

the file structure seems already btw:

ls Procfile main.janet src db project.janet test development.sqlite3 public watch

Just somehow somewhere the 'joy create db' is not working for me.

from joy.

swlkr avatar swlkr commented on June 14, 2024

So it was bad timing on my part, I switched the database code to the db library (for postgres support) but I didn't update the files generated from joy new so there's an old version of joy 0.6.0 in the generated project.janet

I pushed some changes and tagged them version 0.7.3 the changes are on line 25 in server.janet:

(db/connect (env :database-url))

so you don't have to pass DATABASE_URL

from joy.

swlkr avatar swlkr commented on June 14, 2024

You could also install the latest version of joy by changing the project.janet to look like this:

(declare-project
  :name "%project-name%"
  :description ""
  :dependencies ["https://github.com/joy-framework/joy"]
  :author ""
  :license ""
  :url ""
  :repo "")

(declare-executable
  :name "%project-name%"
  :entry "main.janet")

(phony "server" []
  (do
    (os/shell "pkill -xf 'janet main.janet'")
    (os/shell "janet main.janet")))

(phony "watch" []
  (do
    (os/shell "pkill -xf 'janet main.janet'")
    (os/shell "janet main.janet &")
    (os/shell "fswatch -o src | xargs -n1 -I{} ./watch")))

The main change:

-   :dependencies [{:repo "https://github.com/joy-framework/joy" :tag "0.6.0"}
-                  "https://github.com/joy-framework/tester"]
+ :dependencies ["https://github.com/joy-framework/joy"]

and then run jpm deps to install the latest joy

from joy.

swlkr avatar swlkr commented on June 14, 2024

I recorded a quick asciinema (like in the other issue) just to show how it's working now with the latest version, there may be a long pause towards the end, sorry about that

asciicast

from joy.

kwccoin avatar kwccoin commented on June 14, 2024

Thanks. Would try it tomorrow. Quite late here.

from joy.

kwccoin avatar kwccoin commented on June 14, 2024

All can be done now. Great.

from joy.

kwccoin avatar kwccoin commented on June 14, 2024

I will study a bit the db part. Seems job create db and doing something there but not sure what. got schema, got ... just no actual db records. Strange. But I guess I just have to close the case and study more about this.

from joy.

Related Issues (20)

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.