Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 27 15:09
    CircleCI success: postlight build (#1390) in https://github.com/postlight/lux
    • release: v1.2.3 🔧 (#734)
      (812555a28565fcda62dd9993e35584ab3ddb9442 by GitHub)
  • Feb 27 14:52
    CircleCI timedout: postlight build (#1389) in https://github.com/postlight/lux
    • fix: address known vulnerabilities in dependencies
      (6bbbdeaabd76aaf9c0778110cdbf9a45fc35faee by Zachary Golba)
  • Feb 27 14:48
    CircleCI timedout: postlight build (#1388) in https://github.com/postlight/lux
    • fix: address known vulnerabilities in dependencies
      (6bbbdeaabd76aaf9c0778110cdbf9a45fc35faee by Zachary Golba)
  • Feb 04 22:14
    CircleCI success: postlight build (#1384) in https://github.com/postlight/lux
    • Add distr
      (72cceff9a0b58f8db0073b762d0bc34d7cd3f9ad by Ralf Schimmel)
  • Feb 04 22:08
    CircleCI canceled: postlight build (#1383) in https://github.com/postlight/lux
    • Stable + skipBuild
      (acc4ed4a9739ab8a798daa3e2985e9019070e80c by Ralf Schimmel)
  • Jan 24 13:54
    nickschot commented #741
  • Jan 24 13:47
    nickschot opened #741
  • Jan 24 13:34
    nickschot commented #739
  • Jan 23 13:25
    nickschot commented #732
  • Jan 23 12:51
    nickschot closed #740
  • Jan 23 12:51
    nickschot opened #740
  • Jan 23 11:15
    nickschot commented #737
  • Jan 23 11:14
    nickschot commented #737
  • Jan 23 11:10
    nickschot edited #737
  • Jan 23 11:05
    nickschot edited #737
  • Jan 23 11:04
    codecov[bot] commented #737
  • Jan 23 11:04
    codecov[bot] commented #737
  • Jan 23 11:04
    nickschot synchronize #737
  • Jan 19 18:30
    adriennn commented #624
  • Jan 03 10:42
    CircleCI success: postlight build (#1381) in https://github.com/postlight/lux
    • fix: falsy IDs breaking relationships
      (568347b19d63ecf306c6f38df6708af9b1187afc by Nick Schot)
Jame
@jamemackson
you might use a config file like this:
const {
  DB_HOST = 'localhost',
  DB_PORT = '5432',
  DB_USER = 'postgres',
  DB_PASS = '',
  DB_NAME = 'my_db'
} = process.env;

export default {
  // development: {
  //   driver: 'sqlite3',
  //   database: 'server_dev'
  // },

  development: {
    driver: 'pg',
    database: DB_NAME,
    host: DB_HOST,
    port: DB_PORT,
    username: DB_USER,
    password: DB_PASS
  },

  test: {
    driver: 'sqlite3',
    database: 'server_test'
  },

  production: {
    driver: 'pg',
    database: DB_NAME,
    host: DB_HOST,
    port: DB_PORT,
    username: DB_USER,
    password: DB_PASS
  }
};
Jame
@jamemackson
@jeffery_daniel_twitter ^^ :)
Daniel Jeffery
@jeffery_daniel_twitter
Hey!
Nice :)
Jame
@jamemackson
hey all. Clearly there is not much activity here or on gh but I was just curious to get a gauge on how many people are actively using lux these days? PM me if you’d prefer. but just wondering if we’re the only ones rocking lux in production w/o much support or updates as of late…
YohanJuan
@YohanJuan
First of all, thank you to everyone who has contributed to this project. @jamemackson , to answer your questions, I started a project with Lux but haven't finished it. I don't think I'd be able to give any meaningful upstream contributions until next summer because I wouldn't be able to start working in earnest on my Lux server until then. Important: If I were to contribute, I'd be doing so at the junior level. For what it's worth, that is the level to which I can invest in this project. Thanks.
Jame
@jamemackson
thanks for the reply @YohanJuan - good luck on your project. feel free to ping here if you have any issues / questions.
YohanJuan
@YohanJuan
Thanks, @jamemackson !
Yuri Scarbaci
@YuriScarbaci

Hello everyone,
I'm having some little issues with the creation of resources, with the CLI lux g resource name [attrs...], I need to generate some relationships with custom keys, but apparently the documentation isn't too specific on how to do that, if for example I would like to have a Users table to have a 1-1 relationship with the Files table, and name the key inside Users avatar, how can I accomplish it? also can a model like Users have two distinct relationships with the same table under different keys? ( once again an example with users and file, can a user have both a 1-1 logo file, and hasMany 1-n rel uploadedFiles ? )

The framework is great so far, but I find the documentation a bit lacking on specification, for example about the type of attributes available with the cli command generate && there is absolutly no info on how a seeder should be implemented at all...

Jame
@jamemackson
Hey @YuriScarbaci sorry for the slow reply here. you are correct in that the documentation is greatly lacking and the community has dwindled here this year… postlight, the organization who sponsored the creation of lux, has been very busy on other things and isn’t doing much of anything with the project right now.
Josh Justice
@CodingItWrong
Hey everyone, I am trying Lux for the first time and have a very basic question. When I'm POSTing to create a resource, the attributes I'm passing in aren't being saved; they're left as nulls. Can y'all see something obvious I'm missing?
class RestaurantsController extends Controller {

}
class RestaurantsSerializer extends Serializer {
  attributes = [
    'name',
    'address'
  ];
}
export function up(schema) {
  return schema.createTable('restaurants', table => {
    table.increments('id');
    table.string('name');
    table.string('address');
    table.timestamps();

    table.index('created_at');
    table.index('updated_at');
  });
}
{
    "data": {
      "type": "restaurants",
      "attributes": {
        "name": "Sushi Place",
        "address": "123 Main Street"
      }
    }
}
The response:
{
    "data": {
        "id": "3",
        "type": "restaurants",
        "attributes": {}
    },
    "links": {
        "self": "http://localhost:4000/restaurants"
    },
    "jsonapi": {
        "version": "1.0"
    }
}
If I try to GET that resource afterward:
{
    "data": {
        "id": "1",
        "type": "restaurants",
        "attributes": {
            "name": null,
            "address": null
        }
    },
    "links": {
        "self": "http://localhost:4000/restaurants/1"
    },
    "jsonapi": {
        "version": "1.0"
    }
}
Josh Justice
@CodingItWrong
In case it's helpful, defining a validates property on the model doesn't seem to work to reject the POST; it still goes through:
class Restaurant extends Model {
  static validates = {
    name: value => !!value,
    address: value => !!value,
  }
}
Jame
@jamemackson
hey @CodingItWrong i think you’re missing a params array on the controller.
Josh Justice
@CodingItWrong
That sounds like it could do it! I'll give it a try.
The docs for Controller#params say "If you do not override this property all of the attributes specified in the Serializer that represents a Controller's resource." - so i'm surprised that doesn't seem to be
Jame
@jamemackson
interesting. i just always define it
Josh Justice
@CodingItWrong
yup, defining params makes the attributes pass in just fine. tx jame!
i'll open an issue with the fact that the behavior doesn't seem to match up with that statement in the docs
but i have what i need to get stuff working :+1:
Jame
@jamemackson
that’s great! ping me if you run into anything else
😀
Josh Justice
@CodingItWrong
I'm working on a tutorial for Lux so I may have a few different questions as I go to point folks to.
SQLite is all I need for the tutorial, but if folks want to change the database, where can they find info about what drivers are available and what values to put into config/database.js?
Jame
@jamemackson
very nice Josh! i can send you a snippet in a little while for what i use with postgres. that or search up :point_up: and you’ll find this having been discussed before a while back.
Josh Justice
@CodingItWrong
sweet will search, tx
Josh Justice
@CodingItWrong
Hi everyone! I'm working on howtojsonapi.com, a central web site for learning JSON:API in any framework. As part of it I created a tutorial for Lux. Please check it out and let me know anything I should fix! I don't work in Lux everyday so I'm sure there are things I missed. https://howtojsonapi.com/node.html
Jame
@jamemackson
@CodingItWrong very nice write up!
you can save a little bit of that work by using lux generate resource … which will create the route, serializer and controllers and save people a few steps.
Josh Justice
@CodingItWrong
that's great, thank u for that! will absolutely put it in
Josh Justice
@CodingItWrong
whoa it fills in the params and attributes too 😍
Josh Justice
@CodingItWrong
btw does lux have any kind of data-seeding mechanism?
i'd definitely put it in the tutorial if so
Josh Justice
@CodingItWrong
@jamemackson updated for lux generate resource, even nicer :-D https://howtojsonapi.com/node.html
Jame
@jamemackson
🤘🏼
Romain LE BARO
@scandinave
@CodingItWrong Nice tutorial but you can also use
restaurant:belongs-to to automate relationship generation. Same for has-many and has-one
Josh Justice
@CodingItWrong
@scandinave awesome, I will give that a try!
Josh Justice
@CodingItWrong
@scandinave is that documented anywhere in the guides or api? i couldn't find it
Jame
@jamemackson
the documentation is definitely lacking
Josh Justice
@CodingItWrong
Wow, with those changes Lux is really zero-config for my tutorial! That makes it the easiest of the backend frameworks I tried. Nice work!
Romain LE BARO
@scandinave
Not documented. I have to search inside the source code to find it. But in my sens it miss support for alias inside the cli. Like if we have 2 relations of the same type like owner of type user and stranger of type user too.