Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
jsonapi-store-relationaldb
Advanced tools
jsonapi-server-relationaldb
is a relational database backed data store for jsonapi-server
.
This project conforms to the specification laid out in the jsonapi-server handler documentation.
var RelationalDbStore = require("jsonapi-store-relationaldb");
jsonApi.define({
resource: "comments",
handlers: new RelationalDbStore({
dialect: "mysql",
host: "localhost",
port: 3306,
database: "jsonapi", // If not provided, defaults to the name of the resource
username: "root",
password: null,
logging: false
})
});
Note: the logging
property controls the logging of the emitted SQL and can either be false
(which will mean it will be captured by the internal debugging module under the namespace jsonApi:store:relationaldb:sequelize
) or a user provided function (e.g. console.log
) to which a string containing the information to be logged will be passed as the first argument.
Getting this data store to production isn't too bad...
(new RelationalDbStore()).populate()
to have this module attempt to create the require tables. If you enable debugging via DEBUG=jsonApi:store:*
you'll see the create-table statements - you can target a local database, call populate(), grab the queries, review them and finally run them against your production stack manually.When deploying schema changes, you'll need to correct your database schema - database migrations are left as an exercise for the user. If your schema are likely to change frequently, maybe consider using a different (less schema-driven) data store.
When changing columns in a production database, a typical approach might be to create a new table that is a clone of the table in production, copy all data from the production table into the new table, run an ALTER-TABLE command on the new table to adjust the columns (this may take a while and will lock the table), then run a RENAME-TABLES to swap the production table out for the new one.
Relational databases don't differentiate between undefined
and null
values. Joi
does differentiate between undefined
and null
values. Some undefined
properties will pass validation, whilst null
properties may not. For example, the default articles resource contains a created
attribute of type "date"
- this won't pass validation with a null
value, so the Joi schema will need tweaking.
FAQs
Relational data store for jsonapi-server.
We found that jsonapi-store-relationaldb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.