Code Monkey home page Code Monkey logo

joy's People

Contributors

cpjolicoeur avatar goto-engineering avatar hammywhammy avatar harryvederci avatar hweeks avatar hxw avatar mikebeller avatar noocsharp avatar oz123 avatar pepe avatar swlkr avatar uvtc avatar yumaikas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joy's Issues

Serving JS modules with proper content-type

When you try and create a <script src="/app.js" type="module"> joy has no idea what content-type it is. It should be 'application/js' but is getting no type. To reproduce:

Take your default scaffolding, and update layout.janet to this:

(import joy :prefix "")

(defn app [{:body body :request request}]
  (text/html
    (doctype :html5)
    [:html {:lang "en"}
     [:head
      [:meta {:charset "utf-8"}]
      [:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
      [:meta {:name "csrf-token" :content (authenticity-token request)}]
      [:link {:href "/app.css" :rel "stylesheet"}]
      [:title "test"]]
     [:body
      body
      [:script {:src "/app.js" :type "module"}]]]))

The HTML output is dead right. If you could show me where to make that update I'd be game. I just was not seeing a place that was obvious to me, as I'm currently just learning janet.

Here maybe?

License needs to be GNU GPL

Hey, just thought I'd leave a friendly note that since Circlet is built on Mongoose, which is GNU GPL licensed, MIT isn't an appropriate license for this project. Do leave a comment if you find an MIT-licensed http server in/for Janet, as that is something I'm interested in.

Get query params on request

Hey, nice project, just a small thing: If I send a request to a path like /home?name=something

It would be nice if the request handler could parse the query params into the map. I can see there is a :params struct which is empty, perhaps have another srtuct called :query for easy access to these things? e.g.

:query @{"name" "something"}

cli

  • joy new
  • joy create database
  • joy create migration <migration-name>
  • joy create route <route-name> (based on a table in the database)
  • joy create table <table-name> '<column definition>' '<column definition>' (creates a migration with a create table statement)
  • joy migrate
  • joy rollback

Website

  • push live
  • open source
  • add tutorial video
  • make video better
  • let's encrypt ssl

Auth

joy add auth table <table>
joy add auth routes <table>

  • the routes command creates two route files, sessions.janet and <table>.janet along with common functions for auth and it updates your routes file with defroutes private

  • <table> will be the name of the table responsible for authenticating people (accounts, users, whatever)

  • when you (import auth) you have access to the default auth middleware (auth) which should prevent users from accessing anything without [:session :<table> :id]

  • Generate table <table> with fields email, last-sign-in-at, code, code-created-at

  • Send magic link email

  • Generate a middleware file for checking authentication

- [ ] Generate table <table> with fields email, password, last-sign-in-at, reset-password-token, reset-password-token-expires-at
- [ ] Generate session and <table> routes with sign up/in/out + forgot/reset password functions
- [ ] Generate a reset password "mailer" file
- [ ] Generate a middleware file for checking authentication
- [ ] Send reset password emails
- [ ] Two factor auth

Link Rendering Problem

[:p "Powered by" [:a {:href "https://www.w3schools.com/w3css/default.asp" :title "W3.CSS" :target "_blank" :class "w3-hover-text-blue"} "W3.CSS"]]

This code doesn't create: Powered by W3.CSS <-- with the last part as a link
Only output is : Powered by
link is blank
What am I doing wrong here?
and What is poolparty?
Enjoying the framework Thanks!

enviromental path

Hi there,

Keen to give this a go! Running on Ubuntu. The install for janet and joy seemed to go just fine, however I can't run this from the command line. Is there a path you could suggest? I've tried adding this, but I don't think its the right file:

export PATH="/usr/local/lib/janet/bin:$PATH"

thanks!

snake case column names in db/execute

or since that's probably too hard, update all of the sql functions to snake case every column and then in db/execute snake case the params dictionary

Cannot install Mac OS

Hello, I have an issue with installation vis jpm - here are the last few lines of the output:

Installed as 'tester'.
copying src/tester.janet to /usr/local/Cellar/janet/1.9.0/lib/janet...
From https://github.com/joy-framework/dotenv
 * branch            master     -> FETCH_HEAD
Already up-to-date.
no dependencies found
removing /usr/local/Cellar/janet/1.9.0/lib/janet/dotenv.janet
removing /usr/local/Cellar/janet/1.9.0/lib/janet/.manifests/dotenv.jdn
Uninstalled.
generating /usr/local/Cellar/janet/1.9.0/lib/janet/.manifests/dotenv.jdn...
Installed as 'dotenv'.
copying dotenv.janet to /usr/local/Cellar/janet/1.9.0/lib/janet...
removing /usr/local/bin/joy
Error building git repository dependency: No such file or directory: /usr/local/bin/joy

An easier starting template with less files/folders

It's probably going to wind up looking something like this:

├── app.janet
├── project.janet
├── public
│   ├── app.js
│   ├── app.css
├── test
│   └── app-test.janet
└── watch

Where app.janet looks like this:

(use joy)

(defn layout [{:body body :request request}]
  (text/html
    (doctype :html5)
    [:html {:lang "en"}
     [:head
      [:title "new project"]
      [:meta {:charset "utf-8"}]
      [:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
      (link {:href ["/app.css"]})
      (script {:src ["/app.js"] :defer ""})]
     [:body
       body]]))

(defn home [request]
  [:h1 "You found joy!"])

(def routes (routes [:get "/" home]))

(def app (app {:layout layout}))

(server app 9001)

`joy create route` fails due to nil response from `route-string`

joy create route fails with the error:

error: bad slot #1, expected string|symbol|keyword|buffer, got nil
  in file/write
  in <anonymous> [/usr/local/Cellar/janet/1.8.1/lib/janet/joy/cli/routes.janet] on line 112, column 7
  in create [/usr/local/Cellar/janet/1.8.1/lib/janet/joy/cli/routes.janet] (tailcall) on line 111, column 5

because route-string is returning nil. Adding a few print statements to create:

    (print "Table Name: " table-name)
    (print "Route String: " route-textstring)

right after the let results in:

% joy create route account
Table Name: account
Route String: nil

I don't know Janet, but it looks like columns goes out of scope before the end of the function.

Anyhow, what am I missing?

Error following tutorial. Unknown symbol "id" on line 28

compile error: unknown symbol "id" on line 28, column 23 while compiling src/routes/account.janet
compile error: unknown symbol "account/index" on line 8, column 3 while compiling src/routes.janet
compile error: unknown symbol "routes/app" on line 6, column 14 while compiling src/app.janet
compile error: unknown symbol "app" on line 4, column 1 while compiling main.janet

Following https://github.com/joy-framework/joy/blob/master/docs/tutorial.md . After creating db, running migration and creating route, server fails to start.

Automation and Code Quality Gates

What I'm Proposing

I'd like to see this project build and publish docker containers, as well as run tests and code quality checks on each commit. I'm open to the idea I just really enjoy tooling and making stuff automated, and it's not needed in this project.

I was thinking we could use CircleCI or Travis, both have permanent free tiers for open source projects. Ideally the job flow would look like this:

Each PR Job

  1. Run the test suite
  2. Enforce coverage
  3. Check if docker container can build

Each Master Job

  1. All steps from PR
  2. Build and publish a new docker container to docker hub
  3. Create a tag and release for Joy, push back to repo
  4. Run an integration test suite (this is a new feature we'd have to discuss)

Who will do it?

I'm very happy to do this work, explain and document the release process, and steps in the CI config. I'm also going need you to create some accounts that the joy-org "owns", namely:

  1. CircleCI/Travis Account
  2. Docker Hub Account
  3. Github Token

These can be safely obfuscated by you, and I can show you how to embed these values in either platform. If this seems like something you'd like, let me know and I'll get it knocked out for you!

Final Thoughts

If you like this we can talk about automated release management, and more. I think it's a good idea to try out the simple case first, see if there is any value for the project, and extend it at a future date.

If merged the MR would be two files:

  1. Config for CircleCI/Travis
  2. CONTRIBUTING.md with info and guides

Deployment

There's nothing better than running a single command to get things onto the internet, I'm thinking something like

joy login # enter email/password
joy deploy # deploys to either your-project.joyframework.com or somewhere else

And since I hate pushing to a git repo and separately having to deploy the thing, set up a webhook url that deploys on a push to master

Can't install on Windows

Hi,

When running
jpm install joy
I get

error: No such file or directory: nil\.cache
  in os/mkdir
  in mkdir [E:\Janet-1.9.1\bin\\jpm.janet] on line 145, column 3
  in install-git [E:\Janet-1.9.1\bin\\jpm.janet] on line 687, column 3
  in install-git [E:\Janet-1.9.1\bin\\jpm.janet] on line 678, column 11
  in install [E:\Janet-1.9.1\bin\\jpm.janet] (tailcall) on line 1072, column 20

I do have git installed.

Getting Started - module joy/db error (Joy 0.7.2)

Followed the Getting Started in the readme and got an error after creating the account route:

error: could not find module joy/db

Resolved by changing the import in src/routes/account.janet:

- (import joy/db)
+ (import db)

Running on a Mac (Mojave 10.14.6). Joy Version: 0.7.2. Janet Version:1.8.1

Thanks 🙌🏻

Handle joins where the foreign key columns don't follow convention

Everything is ok now with the following schema

account table

id name
3 'account 1'
4 'account 2'

todo table

id name account_id
1 'todo 1' 3
2 'todo 2' 3
(db/fetch [:account 3 :todo]) 

emits

select *
from todo
join account on account.id = todo.account_id
where account.id = 3

But if you try something else where the schema doesn't follow the convention where foreign key columns don't match the name of the table (account -> account_id), this doesn't work.

There's currently no way to specify this yet.

joy server not working on Mac

after finding joy, I tried based on sample script here but failed with:

joy server error: DATABASE_URL environment variable isn't set in connect [/usr/local/Cellar/janet/1.8.1/lib/janet/db/sqlite/db.janet] on line 10, column 5 in start [src/server.janet] (tailcall) on line 25, column 5 in _thunk [main.janet] on line -1, column -1 in cli-main [boot.janet] on line 2446, column 35

I persist and whilst the db creation all ok, it is obviously not working and the final to do joy server every command. This is the final output:

joy server error: could not find module joy/db: /usr/local/Cellar/janet/1.8.1/lib/janet/joy/db.jimage /usr/local/Cellar/janet/1.8.1/lib/janet/joy/db.janet /usr/local/Cellar/janet/1.8.1/lib/janet/joy/db/init.janet /usr/local/Cellar/janet/1.8.1/lib/janet/joy/db.so joy/db.jimage joy/db.janet joy/db/init.janet joy/db.so in require [boot.janet] on line 2211, column 20 in import* [boot.janet] on line 2229, column 15 in _thunk [src/routes/account.janet] (tailcall) on line 2, column 1 error: DATABASE_URL environment variable isn't set in connect [/usr/local/Cellar/janet/1.8.1/lib/janet/db/sqlite/db.janet] on line 10, column 5 in start [src/server.janet] (tailcall) on line 25, column 5 in _thunk [main.janet] on line -1, column -1 in cli-main [boot.janet] on line 2446, column 35

Any further help?

PostgreSQL only works with ENV variable

Right now when you put DATABASE_URL for PostgreSQL in .env it won't work, because db will still try to load sqlite3. This is because db checks for a real ENV variable to determine database type and dotenv loader does not set real variable, I think. Perhaps it should? Or perhaps there should be some mandatory setup step in db where you pass an URL?

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.