by

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 2019 15:09
    CircleCI success: postlight build (#1390) in https://github.com/postlight/lux
    • release: v1.2.3 🔧 (#734)
      (812555a28565fcda62dd9993e35584ab3ddb9442 by GitHub)
  • Feb 27 2019 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 2019 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 2019 22:14
    CircleCI success: postlight build (#1384) in https://github.com/postlight/lux
    • Add distr
      (72cceff9a0b58f8db0073b762d0bc34d7cd3f9ad by Ralf Schimmel)
  • Feb 04 2019 22:08
    CircleCI canceled: postlight build (#1383) in https://github.com/postlight/lux
    • Stable + skipBuild
      (acc4ed4a9739ab8a798daa3e2985e9019070e80c by Ralf Schimmel)
  • Jan 24 2019 13:54
    nickschot commented #741
  • Jan 24 2019 13:47
    nickschot opened #741
  • Jan 24 2019 13:34
    nickschot commented #739
  • Jan 23 2019 13:25
    nickschot commented #732
  • Jan 23 2019 12:51
    nickschot closed #740
  • Jan 23 2019 12:51
    nickschot opened #740
  • Jan 23 2019 11:15
    nickschot commented #737
  • Jan 23 2019 11:14
    nickschot commented #737
  • Jan 23 2019 11:10
    nickschot edited #737
  • Jan 23 2019 11:05
    nickschot edited #737
  • Jan 23 2019 11:04
    codecov[bot] commented #737
  • Jan 23 2019 11:04
    codecov[bot] commented #737
  • Jan 23 2019 11:04
    nickschot synchronize #737
  • Jan 19 2019 18:30
    adriennn commented #624
  • Jan 03 2019 10:42
    CircleCI success: postlight build (#1381) in https://github.com/postlight/lux
    • fix: falsy IDs breaking relationships
      (568347b19d63ecf306c6f38df6708af9b1187afc by Nick Schot)
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.
Kauserali
@aliHafizji

Hi there I'm trying to create a custom action with the following:

async currentUser(request,response) {

return await this.index(request,response);

}

The above is for the route /users/me

I keep getting this error:

TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)

Any idea what could be wrong here?
Kauserali
@aliHafizji
@jamemackson @nickschot Any help with the above?
Kauserali
@aliHafizji
@nickschot I'm running the lux docker container and would like to know how I can listen to all requests on 0.0.0.0
Is that possible to do?
Devonte
@devotox
will there bue any further updates to lux?
and why does the model only state relationships
and not the attributes
Devonte
@devotox
and can you defined relationships in the generate command
Siddharth Gelera
@barelyhuman
How do I get migrations working with the mysql connector?