Coder Social home page Coder Social logo

parse-stack-example's Introduction

Parse Server with Ruby Rack Example

This is a sample application to showcase using the ruby Parse-Stack gem with Parse-Server.

Getting Started

Make sure you have your API keys for your Parse-Server handy. To get started, clone this repo and run the bundle command.

$ bundle install
$ rake setup

Edit the config/parse.rb file so that it is configured with your Parse-Server API keys. You may optionally use a .env file that will be loaded into your ENV.

# in .env
PARSE_APP_ID=<YOUR_APP_ID>
PARSE_API_KEY=<YOUR_API_ID>
PARSE_MASTER_KEY=<YOUR_MASTER_KEY>
PARSE_SERVER_URL=http://localhost:1337/parse
# Below is the accessible URL for this Rack server
# When running locally, it is localhost:3000
HOOKS_URL=<http://localhost:3000/>

Upgrade Your Schema

We have added some sample models and webhooks in this example application for you to play around. We recommend you run this example with an new Parse application.

$ rake parse:upgrade

The above should create and update the classes that are defined in the models directory with your Parse-Server and upgrade your database schema.

Playground

Now you are ready to go! Try running the rake console command and perform a few queries.

$ rake console
    franky = Artist.first_or_create({name: "Frank Sinatra"})
    franky.save

    song = Song.first_or_create(name: "Fly Me to the Moon")
    song.released = 1964
    song.genres = ['jazz','big band']
    song.artist = franky
    song.save

    Song.count :released.before => 1965
    Song.first :artist => franky

Run Webhooks Server

You can have this rack application handle incoming Parse webhooks based on what you have defined in the webhooks folder. Make sure you already have a Parse-Server running. To start this server use:

    # Register webhooks
    $ rake parse:webhooks:register
    # Start the server
    $ rake start

This will start the rack server and begin handling requests from your Parse-Server. You can automatically have Parse-Stack register your defined webhooks with your Parse-Server with the task rake parse:webhooks:register after you have defined a valid HOOKS_URL environment variable.

parse-stack-example's People

Contributors

apersaud avatar

Watchers

 avatar  avatar  avatar

Forkers

joesadmercado

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.