Comments (10)
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.
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.
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.
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.
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.
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.
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
from joy.
Thanks. Would try it tomorrow. Quite late here.
from joy.
All can be done now. Great.
from joy.
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)
- Can't configure body size limit HOT 1
- entr: command not found HOT 1
- updated_at column is not updated on save
- Can't start server HOT 2
- Improvement suggestion for the default template HOT 3
- Dockerfile - alpine version used is quite outdated HOT 1
- unknown symbol auto-routes in new projects HOT 2
- serve images net::ERR_CONTENT_LENGTH_MISMATCH HOT 2
- Joy does not install properly with "jpm install joy" HOT 2
- path module is now in spork HOT 4
- Usability / Docs: joy create migration does not create an empty migration HOT 1
- db/connect does not use the .env file as documented
- db/insert tries to make a parameter for db/table when params has no table name HOT 4
- validator params does not act as documented HOT 1
- Doc update: rescue cannot be used in macro chains HOT 1
- Returning alternate status (such as 401) does not use the layout
- performance? HOT 7
- Error escaping raw strings inside html HOT 2
- Issue on a mac and a couple of question HOT 3
- Joy build failed using (sudo) jpm install HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joy.