mirror of
https://github.com/wassname/talk.git
synced 2026-08-14 12:50:17 +08:00
Initial commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"sourceMaps": true,
|
||||
"presets": [
|
||||
"stage-0",
|
||||
"es2015-minimal"
|
||||
],
|
||||
"plugins": [
|
||||
["transform-decorators-legacy"],
|
||||
["transform-react-jsx", { "pragma": "h" }],
|
||||
["transform-object-assign"]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{package.json,.*rc,*.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -0,0 +1 @@
|
||||
test/*.conf.js
|
||||
@@ -0,0 +1,8 @@
|
||||
/node_modules
|
||||
/npm-debug.log
|
||||
/build
|
||||
/server/widgets/*.js
|
||||
/server/widgets/*.html
|
||||
.DS_Store
|
||||
config.json
|
||||
*.iml
|
||||
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 4
|
||||
@@ -0,0 +1,11 @@
|
||||
Copyright 2016 Mozilla Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
See the License for the specific language governing permissions and limitations under the License.
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"name": "coral-talk",
|
||||
"version": "0.0.1",
|
||||
"description": "A commenting platform.",
|
||||
|
||||
"author": "The Coral Project",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jde/talk/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jde/talk#readme",
|
||||
|
||||
"main": "src/server.js",
|
||||
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jde/talk.git"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --inline --hot --progress",
|
||||
"prestart": "npm run build",
|
||||
"build": "webpack -p --progress",
|
||||
"test": "npm run -s lint && npm run -s test:karma",
|
||||
"test:karma": "karma start test/karma.conf.js --single-run",
|
||||
"lint": "eslint {src,test}",
|
||||
"server": "cd server; node index.js",
|
||||
"start": "cd server; node index.js"
|
||||
},
|
||||
|
||||
"keywords": [
|
||||
"coral",
|
||||
"ask",
|
||||
"webpack",
|
||||
"rollup",
|
||||
"babel",
|
||||
"preact"
|
||||
],
|
||||
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.3.3",
|
||||
"babel": "^6.5.2",
|
||||
"babel-core": "^6.7.2",
|
||||
"babel-eslint": "^6.0.0",
|
||||
"babel-loader": "^6.2.4",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"babel-plugin-transform-react-jsx": "^6.6.5",
|
||||
"babel-preset-es2015": "^6.6.0",
|
||||
"babel-preset-es2015-minimal": "^2.0.0",
|
||||
"babel-preset-es2015-rollup": "^1.1.1",
|
||||
"babel-preset-stage-0": "^6.5.0",
|
||||
"babel-register": "^6.7.2",
|
||||
"babel-runtime": "^6.6.1",
|
||||
"chai": "^3.5.0",
|
||||
"core-js": "^2.2.1",
|
||||
"css-loader": "^0.23.1",
|
||||
"eslint": "^2.5.3",
|
||||
"extract-text-webpack-plugin": "^1.0.1",
|
||||
"file-loader": "^0.8.5",
|
||||
"html-webpack-plugin": "^2.14.0",
|
||||
"json-loader": "^0.5.4",
|
||||
"karma": "^0.13.22",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-chai-sinon": "^0.1.5",
|
||||
"karma-mocha": "^0.2.2",
|
||||
"karma-mocha-reporter": "^2.0.0",
|
||||
"karma-phantomjs-launcher": "^1.0.0",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^1.7.0",
|
||||
"less": "^2.6.1",
|
||||
"less-loader": "^2.2.2",
|
||||
"mocha": "^2.4.5",
|
||||
"ncp": "^2.0.0",
|
||||
"phantomjs-prebuilt": "^2.1.6",
|
||||
"postcss-loader": "^0.8.2",
|
||||
"raw-loader": "^0.5.1",
|
||||
"rollup-plugin-babel": "2.4.0",
|
||||
"rollup-plugin-commonjs": "^2.2.1",
|
||||
"rollup-plugin-memory": "^1.0.0",
|
||||
"rollup-plugin-node-resolve": "^1.5.0",
|
||||
"rollup-plugin-replace": "^1.1.0",
|
||||
"rollup-plugin-uglify": "^0.3.1",
|
||||
"sinon": "^1.17.3",
|
||||
"sinon-chai": "^2.8.0",
|
||||
"source-map-loader": "^0.1.5",
|
||||
"style-loader": "^0.13.0",
|
||||
"superstatic": "^4.0.2",
|
||||
"uglify-js": "^2.6.2",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack": "^1.12.14",
|
||||
"webpack-dev-server": "^1.14.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"aws-sdk": "^2.3.16",
|
||||
"babel-helpers": "^6.8.0",
|
||||
"babel-plugin-transform-object-assign": "^6.5.0",
|
||||
"body-parser": "^1.15.0",
|
||||
"compression": "^1.6.1",
|
||||
"cors": "^2.7.1",
|
||||
"decko": "^1.1.3",
|
||||
"express": "^4.13.4",
|
||||
"flatpickr": "^1.8.8",
|
||||
"marked": "^0.3.6",
|
||||
"preact": "^5.4.0",
|
||||
"preact-compat": "^1.6.1",
|
||||
"preact-router": "^1.3.0",
|
||||
"preact-svg": "^1.6.0",
|
||||
"proptypes": "^0.14.3",
|
||||
"pug": "^2.0.0-beta2",
|
||||
"react-gmaps": "^1.5.0",
|
||||
"request": "^2.75.0",
|
||||
"request-promise": "^4.1.1",
|
||||
"rollup": "^0.25.8",
|
||||
"rollup-plugin-postcss": "0.0.27",
|
||||
"standard": "^7.1.2",
|
||||
"wildemitter": "^1.2.0"
|
||||
},
|
||||
"main": "webpack.config.babel.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/* API routes contains general api funcitonality. */
|
||||
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
router.use(function auth(req, res, next) {
|
||||
console.log('Read the user cookie here.');
|
||||
next();
|
||||
});
|
||||
|
||||
// Base route provides server version information.
|
||||
router.get('/', function(req, res) {
|
||||
res.send('App version information goes here....');
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
@@ -0,0 +1,32 @@
|
||||
/* Api comment routes define the handlers for incoming comment related requests. */
|
||||
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
router.use(function (req, res, next) {
|
||||
console.log("Read the cookie to make sure users can do this thing with comments.")
|
||||
next();
|
||||
});
|
||||
|
||||
|
||||
router.get('/', function(req, res) {
|
||||
res.send('Read all of the comments ever');
|
||||
});
|
||||
|
||||
router.get('/:commentId', function(req, res) {
|
||||
res.send('Read a comment');
|
||||
});
|
||||
|
||||
router.post('/', function(req, res) {
|
||||
res.send('Write a comment');
|
||||
});
|
||||
|
||||
router.put('/:commentId', function(req, res) {
|
||||
res.send('Update a comment');
|
||||
});
|
||||
|
||||
router.delete('/:commentId', function(req, res) {
|
||||
res.send('Delete a comment');
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
@@ -0,0 +1,46 @@
|
||||
/* This is the entrypoint for the Talk Platform server. */
|
||||
|
||||
// Initialize application framework.
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
|
||||
// Load routes.
|
||||
var apiRoutes = require("./api/routes");
|
||||
var commentRoutes = require('./comments/routes');
|
||||
|
||||
// Initialize mongoose.
|
||||
var mongoose = require("mongoose");
|
||||
|
||||
// Connect to the database
|
||||
mongoose.connect('mongodb://localhost/talk');
|
||||
var db = mongoose.connection;
|
||||
db.on('error', console.error.bind(console, 'connection error:'));
|
||||
db.once('open', function() {
|
||||
ready();
|
||||
});
|
||||
|
||||
// Initialize Static Endpoints.
|
||||
var initializeStatic = function() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Initialize API endpoints.
|
||||
var initializeAPI = function () {
|
||||
app.use('/api/v1', apiRoutes);
|
||||
app.use('/api/v1/comments', commentRoutes);
|
||||
}
|
||||
|
||||
// Initialize server when ready.
|
||||
var ready = function () {
|
||||
|
||||
var port = 1618;
|
||||
|
||||
initializeStaticEndpoints();
|
||||
initializeAPI();
|
||||
|
||||
// Listen for incoming requests.
|
||||
app.listen(port, function () {
|
||||
console.log('Listening on port ' + port + '!');
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import webpack from 'webpack';
|
||||
import ExtractTextPlugin from 'extract-text-webpack-plugin';
|
||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
const ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
const CSS_MAPS = ENV!=='production';
|
||||
|
||||
module.exports = {
|
||||
context: path.resolve(__dirname, '/src'),
|
||||
entry: ['./server'],
|
||||
|
||||
output: {
|
||||
path: `${__dirname}/build`,
|
||||
publicPath: '/',
|
||||
filename: 'bundle.js',
|
||||
library: 'Ask'
|
||||
},
|
||||
|
||||
externals: {},
|
||||
|
||||
module: {
|
||||
preLoaders: [
|
||||
{
|
||||
test: /\.jsx?$/,
|
||||
exclude: /src\//,
|
||||
loader: 'source-map'
|
||||
}
|
||||
],
|
||||
loaders: [
|
||||
{
|
||||
test: /\.jsx?$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel'
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
loader: 'style-loader!css-loader'
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: 'json'
|
||||
},
|
||||
{
|
||||
test: /\.(xml|html|txt|md)$/,
|
||||
loader: 'raw'
|
||||
},
|
||||
{
|
||||
test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
|
||||
loader: ENV==='production' ? 'file?name=[path][name]_[hash:base64:5].[ext]' : 'url'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
plugins: ([
|
||||
new webpack.NoErrorsPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': JSON.stringify({ NODE_ENV: ENV })
|
||||
})
|
||||
]).concat(ENV==='production' ? [
|
||||
new webpack.optimize.OccurenceOrderPlugin()
|
||||
] : []),
|
||||
|
||||
stats: { colors: true },
|
||||
|
||||
node: {
|
||||
global: true,
|
||||
process: false,
|
||||
Buffer: false,
|
||||
__filename: false,
|
||||
__dirname: false,
|
||||
setImmediate: false
|
||||
},
|
||||
|
||||
devtool: ENV==='production' ? 'source-map' : 'cheap-module-eval-source-map'
|
||||
};
|
||||
Reference in New Issue
Block a user