reacta
A middleware component for express for rendering react components
Last updated 5 years ago by azerothian .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install reacta 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.11                                ...           latest (5 years ago)

8 Versions

  • 0.0.11                                ...           5 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
Maintainers (1)
Downloads
Today 8
This Week 8
This Month 8
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)

Copyright 2014 - 2016 © taobao.org |