Skip to content

Commit 0a900c6

Browse files
committed
initial commit
0 parents  commit 0a900c6

File tree

9 files changed

+160
-0
lines changed

9 files changed

+160
-0
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
3+
# Logs
4+
logs
5+
*.log
6+
7+
# Dependency directory
8+
# Deployed apps should consider commenting this line out:
9+
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
10+
node_modules
11+
12+
#Compiled sources
13+
build

client/components/app.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var React = require('react');
2+
3+
var App = React.createClass({
4+
5+
render: function(){
6+
return (
7+
<div>Hello, World!</div>
8+
);
9+
}
10+
11+
});
12+
13+
module.exports = App;

client/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(function () {
2+
var React = require('react'),
3+
App = require('./components/app.jsx'); // Our custom react component
4+
5+
//Needed for React Developer Tools
6+
window.React = React;
7+
8+
// Render the main app react component into the document body.
9+
// For more details see: https://facebook.github.io/react/docs/top-level-api.html#react.render
10+
React.render(React.createElement(App), document.body);
11+
})();

client/www/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Single-Page App</title>
6+
</head>
7+
<body>
8+
<script type="text/javascript" src="app.js"></script>
9+
</body>
10+
</html>

config/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var path = require('path');
2+
var _ = require('lodash');
3+
4+
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
5+
6+
var base = {
7+
app: {
8+
root: path.normalize(path.join(__dirname, '/..')),
9+
env: env,
10+
},
11+
};
12+
13+
var specific = {
14+
development: {
15+
app: {
16+
port: 1337
17+
}
18+
}
19+
};
20+
21+
module.exports = _.merge(base, specific[env]);

gulpfile.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var gulp = require('gulp');
2+
var del = require('del');
3+
var browserify = require('gulp-browserify');
4+
var concat = require('gulp-concat');
5+
var runSequence = require('run-sequence');
6+
var nodemon = require('gulp-nodemon');
7+
8+
gulp.task('clean', function(cb) {
9+
del(['build/*'], cb);
10+
});
11+
12+
gulp.task('copy', function() {
13+
return gulp.src('client/www/index.html')
14+
.pipe(gulp.dest('build'));
15+
});
16+
17+
gulp.task('browserify', function() {
18+
return gulp.src('client/index.js')
19+
.pipe(browserify({transform: 'reactify'}))
20+
.pipe(concat('app.js'))
21+
.pipe(gulp.dest('build'));
22+
});
23+
24+
gulp.task('build', function(cb) {
25+
runSequence('clean', 'browserify', 'copy', cb);
26+
});
27+
28+
gulp.task('default', ['build'], function() {
29+
gulp.watch('client/*/*', ['build']);
30+
nodemon({ script: 'index.js', ignore: ['gulpfile.js', 'build', 'client', 'dist'] });
31+
});

index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Dependencies
3+
*/
4+
var express = require("express");
5+
6+
/**
7+
* Config
8+
*/
9+
var config = require("./config");
10+
11+
/**
12+
* Server
13+
*/
14+
var app = module.exports = express();
15+
16+
require("./server")(app, config);
17+
18+
// Start app
19+
if (!module.parent) {
20+
app.listen(config.app.port);
21+
console.log("Server started, listening on port: " + config.app.port);
22+
}
23+
console.log("Environment: " + config.app.env);

package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "echo-suggest",
3+
"version": "0.0.0",
4+
"description": "",
5+
"author": "cmrnh",
6+
"private": false,
7+
"main": "index.js",
8+
"repository": {
9+
"type": "git",
10+
"url": ""
11+
},
12+
"scripts": {
13+
"start": "NODE_ENV=development gulp"
14+
},
15+
"engines": {
16+
"node": ">=0.12.0"
17+
},
18+
"dependencies": {
19+
"express": "~4.12.3",
20+
"lodash": "~3.7.0",
21+
"react": "^0.13.3"
22+
},
23+
"devDependencies": {
24+
"del": "^1.1.1",
25+
"gulp": "^3.8.11",
26+
"gulp-browserify": "^0.5.1",
27+
"gulp-concat": "^2.5.2",
28+
"gulp-nodemon": "^2.0.3",
29+
"reactify": "^1.1.0",
30+
"run-sequence": "^1.1.2"
31+
}
32+
}

server/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var express = require('express');
2+
3+
module.exports = function (app, config) {
4+
// Route handling and middleware should go here
5+
app.use(express.static('build'));
6+
};

0 commit comments

Comments
 (0)