Kohana 3 Auth database schema - kohana

I just started to learning Kohana 3.2.
It's nice, and it's similar to django so it is going pretty well.
Bad the documentation is... poor.
And the documentation for an Auth module doesn't exist (i'm not talking about this in userguide because that is pooooor).
I want to use ORM, store users info in database. This should be simple!
But.. I can't even find how database table structure should look like :(
Is there any good doc for that?

First of all you need to enable both Auth and ORM in your bootstrap.
Then you need to tell Auth to use ORM. Go to modules/auth/config/auth.php and change 'driver' => 'file' to 'driver' => 'ORM'.
Table schema can be found in modules/orm folder.
You can find more usefull information here (it's for 3.1 but the differences are not that big).

Related

Call function when document is added to database?

I am working with NodeJS and Cloudant (alternatively the DashDB Warehouse if that works better). I wonder if it is possible to have a function in NodeJS that gets called each time a document has been added to the database? I have checked out indexed views but can't really understand how to do it. Does anyone have any good tips regarding this or what documentation to look at?
You can listen to DB _changes in Cloudant (https://console.bluemix.net/docs/services/Cloudant/api/database.html) in continous mode.
Every document change in the Cloudant DB (create,update,delete) will be notified through this channel.
There are different nodejs libraries you can use with this purpose. This is
one example: https://www.npmjs.com/package/cloudant-follow

How to fetch from nodejs-api-starter into react-starter-kit

I am trying out React-Starter-Kit for the first time and loving all the cutting edge features baked in (apollo/graphql-client in particular). A crucial part of any app for me is the database, and for that my understanding is the same author provides nodejs-api-starter which sets up a REST interface for accessing Postgres at localhost:5000 and has a graphql webui at localhost:5000/graphl.
That is about as far as I have been able to understand of the setup so far. I have changed the frontend code a little bit so a new Component "Counter" is loaded on the home page. I need to be able to make a new counter, fetch the latest counter, and increment decrement the counter. Write now the component just outputs the 'value' retrieved from the server at 5000.
I do not think I am accessing the 5000 server correctly, do I put the port in this url line somehow?
You can pull the repo down from : https://github.com/Falieson/react-starter-kit-crud-counter-demo
This is my first time setting up a nodejs api server, I am used to using MeteorJS which has pub/sub to MongoDB baked in. I am looking forward to the separation the RSK strategy (which seems more industry standard?) provides.
I've just done setting up the full site with Database from React-Stater-Kit, I'm also a newbie so I understand your frustration.
About this question, you don't need the NodeJS-API-Starter, it has enhanced function ( such as Redis cache ) and it's not suited for newbies. You should look deeper into the RSK, it already has the DB. If you ran the boilerplate and played around, change is you'll see file database.sqlite in your folder, it's the database. Here are the things you should learn:
Use SequelizeJS to connect the NodeJS server with database. Your database can be MySQL/MariaDB, PostgreSQL or SQLite. The connection is easy and there's tool to auto-generate Models from your database
How to create GraphQL's Types and Queries. If your queries need to search through the database, import Sequelize's models and use its functions.
Test your API via GraphQLi
Note: if you want to use MongoDB or other NoSQL, try Mongoose instead of Sequelize.

How to do authentication with Node.js, Express and Sequelize?

I've made simple nodejs application by using nodejs+express+angular. Now I want to make user authentification. I want to session handling by using sequelize. Can you advise Simple example which include login/logout and home page using sequelize?
A Google search produces:
https://www.youtube.com/watch?v=vDdJBpOhTNo
https://www.udemy.com/the-complete-node-js-developer-course/learn/v4/content - this is a great tutorial that explains and demonstrates exactly what you are looking for!

MongoDB Permalink Schema Design / ExpressJS implementation for RESTful routing

I am new to mongo, and application design in general, having simply used gems in the past to handle my permalinks (coming from a rails background). I was wondering how best to handle permalinks.
Should you have a collection in mongodb, that links permalinks to their object ids, or is it better to pretty much replace the object id with the permalink acting as the uid? Or should there be some kind of combination of both, where the permalink is simply used in the router and then ids are used in the application internally?
Also some advice on how best to implement these in the application itself as well as the db would be great, I am using expressjs if that's any help.
Thank you.

Posting database views from CouchApp

I am new to CouchDB and CouchApp and I am trying to make a couchapp that can be called on any couchdb database and present the user with the available fields so that he can choose one and get all the records for that field.
It would work kind of like this: One calls the app with something like
http://host:5984/couchapp_db/_design/couchapp_name/index.html?host=data_host:5984&db=data_db
This presents the user with the list of keys in the database. The user selects one and the app shows the values for that field.
That requires that there is a view that gets all fields in the database, I already solved that with the post "how could-i-determine-all-possible-keys-of-a-couchdb-database"
In order to get the values the user asks for, I would need a simple view like:
function(doc) {
if(doc.user_selected_field)
emit(null, doc.user_selected_field)
}
How can you check from the couch app if this view exists for the database and if it does not, how can you create it?
Maybe there is a pretty standard solution to this, but I have not found it, and, as I mentioned, I am just starting with couchdb.
Couchapp may not be your best option for this. You can use CouchDB on multitudes of way more powerful platforms very easily, so why not consider something else?
CouchApp is a very simple platform for viewing your database, think of it like phpMyAdmin but like really customizable.

Resources