Skip to content

Akryum/meteor-instant-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meteor Mysql

Reactive & Easy to use

Base sources from https://github.com/nodets/meteor-mysql converted to (almost) pure meteor package for easy editing.

Thanks to all the nodets/meteor-mysql contributors!

Usage

//Your client side DOES NOT REQUIRE ANY CHANGES!!!
if (Meteor.isClient) {

    Posts = new Mongo.Collection("postsCollection");
    Meteor.subscribe('allPosts')
}

if (Meteor.isServer) {
    Meteor.startup(function () {

        //Start of changes

        var mysqlStringConnection = "mysql://yourusername:yourpassword@127.0.0.1/yourdatabase? debug=false&charset=utf8";

        var db = Mysql.connect(mysqlStringConnection);
        //"posts" -> a table name inside your database.
        Posts = db.meteorCollection("posts", "postsCollection");

        //End of changes, that's it!

        //publish the collection as you used to do with Mongo.Collection
        Meteor.publish("allPosts", function () {
            return Posts.find();
        });

    });
}

About

Meteor Reactive Mysql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published