This repository has been archived by the owner on Apr 30, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lunik
committed
Jul 4, 2017
0 parents
commit 371fd71
Showing
9 changed files
with
4,160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"extends": ["standard"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
|
||
.idea/ | ||
|
||
node_modules/ | ||
|
||
.DS_Store |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "tcloud", | ||
"version": "0.0.1", | ||
"description": "Filesharing and torrent downloading", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "webpack", | ||
"start": "node build/server.js", | ||
"dev": "npm run build && npm start" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Lunik/tcloud.git" | ||
}, | ||
"author": "Guillaume Lunik", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/Lunik/tcloud/issues" | ||
}, | ||
"homepage": "https://github.com/Lunik/tcloud#readme", | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-loader": "^7.1.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"eslint": "^4.1.1", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-config-standard-jsx": "^4.0.1", | ||
"eslint-plugin-import": "^2.3.0", | ||
"eslint-plugin-node": "^5.0.0", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-react": "^7.0.1", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"html-webpack-plugin": "^2.29.0", | ||
"uglifyjs-webpack-plugin": "^0.4.6", | ||
"webpack": "^3.0.0", | ||
"webpack-node-externals": "^1.6.0" | ||
}, | ||
"dependencies": { | ||
"body-parser": "^1.17.2", | ||
"compression": "^1.6.2", | ||
"cookie-parser": "^1.4.3", | ||
"delogger": "^0.9.5", | ||
"express": "^4.15.3", | ||
"react": "^15.6.1", | ||
"react-dom": "^15.6.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/** | ||
* Created by lunik on 04/07/2017. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
import React from 'react' | ||
|
||
export default class Index extends React.Component { | ||
render () { | ||
return ( | ||
<html lang="fr"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>Tcloud</title> | ||
</head> | ||
<body> | ||
<script type="text/javascript" src="app.js"></script></body> | ||
</html> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Created by lunik on 04/07/2017. | ||
*/ | ||
|
||
import Server from './server' | ||
|
||
var server = new Server() | ||
|
||
server.listen(8080) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Created by lunik on 04/07/2017. | ||
*/ | ||
|
||
import Express from 'express' | ||
import Delogger from 'delogger' | ||
import compression from 'compression' | ||
import cookieParser from 'cookie-parser' | ||
import bodyParser from 'body-parser' | ||
import React from 'react' | ||
import {renderToString} from 'react-dom/server' | ||
|
||
import StaticHtml from '../public/static' | ||
|
||
export default class Server { | ||
constructor () { | ||
this.app = Express() | ||
this.app.use(compression()) | ||
this.app.use(cookieParser()) | ||
this.app.use(bodyParser.json()) | ||
this.app.use(bodyParser.urlencoded({ | ||
extended: true | ||
})) | ||
this.app.get('/', function (req, res) { | ||
res.end(renderToString(<StaticHtml />)) | ||
}) | ||
|
||
this.log = new Delogger('Server') | ||
} | ||
listen (port, host) { | ||
host = host || '0.0.0.0' | ||
this.app.listen(port, host, () => this.log.info(`Server listening on ${host}:${port}`)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Created by lunik on 04/07/2017. | ||
*/ | ||
const webpack = require('webpack') | ||
var nodeExternals = require('webpack-node-externals') | ||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin') | ||
const HtmlWebpackPlugin = require('html-webpack-plugin') | ||
|
||
const BUILD_DIR = __dirname + '/build' | ||
module.exports = [ | ||
{ | ||
entry: './src/server/index.js', | ||
output: { | ||
path: BUILD_DIR, | ||
filename: 'server.js' | ||
}, | ||
module: { | ||
loaders: [{ | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
query: { | ||
presets: ['react', 'es2015'] | ||
} | ||
}] | ||
}, | ||
target: 'node', | ||
externals: [nodeExternals()], | ||
plugins: [ | ||
new UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
}, | ||
output: { | ||
comments: false | ||
} | ||
}) | ||
] | ||
}, | ||
{ | ||
entry: './src/public/index.js', | ||
output: { | ||
path: BUILD_DIR, | ||
filename: 'app.js' | ||
}, | ||
module: { | ||
loaders: [{ | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
query: { | ||
presets: ['react', 'es2015'] | ||
} | ||
}] | ||
}, | ||
plugins: [ | ||
new UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
}, | ||
output: { | ||
comments: false | ||
} | ||
}) | ||
] | ||
} | ||
] |