diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..ad8d1fe --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets" : ["es2015", "react"] +} diff --git a/.gitignore b/.gitignore index 5148e52..537f58a 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ jspm_packages # Optional REPL history .node_repl_history + +client/public +db/matterwiki.sqlite diff --git a/client/app/index.jsx b/client/app/index.jsx new file mode 100644 index 0000000..1ab0709 --- /dev/null +++ b/client/app/index.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import {render} from 'react-dom'; + +class App extends React.Component { + render () { + return

Hello React!

; + } +} + +render(, document.getElementById('app')); diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..7d40c85 --- /dev/null +++ b/client/index.html @@ -0,0 +1,14 @@ + + + + Matterwiki + + + +
+ + + diff --git a/db/matterwiki.sqlite b/db/matterwiki.sqlite index 01f495a..ba619a0 100644 Binary files a/db/matterwiki.sqlite and b/db/matterwiki.sqlite differ diff --git a/index.js b/index.js index 989c401..4cb7007 100644 --- a/index.js +++ b/index.js @@ -6,10 +6,12 @@ Once we have enough endpoints defined we start breaking them into modules for be var express = require('express'); var app = express(); -app.get('/',function(req,res){ +app.get('/api',function(req,res){ res.send("Hey! You're looking at the matterwiki API"); }); +app.use(express.static(__dirname + '/client')); + app.listen(5000 || process.env.PORT, function(){ console.log("The magic is happening on port 5000"); }); diff --git a/package.json b/package.json index 42735a9..ed65b71 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "a simple and sexy wiki", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "dev": "webpack -d --watch", + "build" : "webpack -p" }, "bin": { "wiki": "./install.js" @@ -20,7 +22,13 @@ }, "homepage": "https://github.com/nshntarora/matterwiki#readme", "dependencies": { + "babel-loader": "^6.2.5", + "babel-preset-es2015": "^6.13.2", + "babel-preset-react": "^6.11.1", "express": "^4.14.0", - "sqlite3": "^3.1.4" + "react": "^15.3.0", + "react-dom": "^15.3.0", + "sqlite3": "^3.1.4", + "webpack": "^1.13.2" } } diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..53944ca --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,24 @@ +var webpack = require('webpack'); +var path = require('path'); + +var BUILD_DIR = path.resolve(__dirname, 'client/public'); +var APP_DIR = path.resolve(__dirname, 'client/app'); + +var config = { + entry: APP_DIR + '/index.jsx', + output: { + path: BUILD_DIR, + filename: 'bundle.js' + }, + module : { + loaders : [ + { + test : /\.jsx?/, + include : APP_DIR, + loader : 'babel' + } + ] + } +}; + +module.exports = config;