0.0.11 • Published 10 years ago

reacta v0.0.11

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

Reacta

A middleware component for express for rendering react components

Example

Files:

  • public/
  • views/main.ect
<html>
  <head>
    <title>Reacta Test</title>
    <%- @header %>
  </head>
  <body>
    <%- @content %>
    <%- @scripts %>
  </body>
</html>
  • components/home.cjsx
React = require "react"
module.exports = React.createClass {
  render: () ->
    <div>{"Home"}</div>
}
  • index.coffee
express = require 'express'
reacta = require "reacta"
app = express()

ECT = require('ect')
ectRenderer = ECT({ watch: true, root: __dirname + '/views', ext : '.ect' })
app.set('view engine', 'ect')
app.engine('ect', ectRenderer.render)



rc = reacta {
  static: "/libs"
  env: "development"
  components: "components"
  webpack:
    resolve:
      extensions: ['', '.js', '.cjsx', '.coffee']
    module:
      loaders: [
        { test: /\.cjsx$/, loaders: ['coffee', 'cjsx'] },
        { test: /\.coffee$/, loader: 'coffee' }
      ]
}

app.use express.static(__dirname + '/public')
rc.static(express, app);

app.get '/', rc.create "home", {
  view: "main"
  props: {}
  templateProps: {}
  dependencies: ["./next"]
}



rc.compile().then () ->
  console.log "listening on 3030"
  app.listen(3030)

Changelog

0.0.11

  • Re-written to just be a piece of middleware for express using webpack.
  • React Router has been moved and will be reimplemented in separate package reacta-router
  • same with the express api deps tree code 0.0.11 <
  • removed as has no reference any more
0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago