Coder Social home page Coder Social logo

sails-react-example's Introduction

Sails.js + React.js Examples

Inspired by the React.js tutorials, these examples shows ways to integrate Sails.js as the real time persistent backend model to a React.js frontend. Two examples are provided: a markdown chat application and the TodoMVC application. Both showcasing the real time capabilities for multiple clients.

References

Run Instructions

Prerequisites

git clone https://github.com/mixxen/sails-react-example.git
cd sails-react-example
npm install
bower install
node app.js
open http://localhost:1337 (open multiple windows to see real time capabilities of Sailsjs)

Start from Scratch

  1. Install Sails

    sudo npm -g install sails
    
  2. Create new Sails project

    sails new sails-react-example
    
  3. Change directory to sails-react-example

  4. Install grunt-babel

    npm install grunt-babel babel-preset-es2015 babel-preset-react --save
    
  5. Edit compileAssets.js syncAssets.js config/babel.js to support jsx files

  6. Install bower and add components (see bower.json)

npm install bower --save
  1. Create assets/styles/styles.css for styles and animation css

  2. Create models and controllers

    sails generate comment
    
  3. Edit views/xxx.ejs and put <div class="container" id="myComponent"></div> somewhere

  4. Be sure to call ReactDOM.render somewhere and reference the div in previous step. Example:

    ReactDOM.render(
      <CommentBox url="/comment" data={message} />,
      document.getElementById('myComponent')
    );

Screenshots

alt tag

Todo

sails-react-example's People

Contributors

mixxen avatar ra100 avatar

Watchers

 avatar

Forkers

thegil

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.