mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-12 04:23:09 +02:00
Creating repository
This commit is contained in:
commit
d718bd1885
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.idea/
|
||||
PiGallery2.iml
|
||||
node_modules/
|
||||
typings/
|
76
backend/server.js
Normal file
76
backend/server.js
Normal file
@ -0,0 +1,76 @@
|
||||
///<reference path="../typings/tsd.d.ts"/>
|
||||
var _express = require('express');
|
||||
var _debug = require('debug');
|
||||
var _http = require('http');
|
||||
var debug = _debug("PiGallery2:server");
|
||||
var app = _express();
|
||||
if (process.env.DEBUG) {
|
||||
console.log("Running in DEBUG mode");
|
||||
app.use(_morgan('dev'));
|
||||
}
|
||||
app.use(_express.static(__dirname + './../frontend'));
|
||||
app.use('/node_modules', _express.static(__dirname + './../node_modules'));
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
var port = normalizePort(process.env.PORT || '3001');
|
||||
app.set('port', port);
|
||||
/**
|
||||
* Create HTTP server.
|
||||
*/
|
||||
var server = _http.createServer(app);
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
function normalizePort(val) {
|
||||
var port = parseInt(val, 10);
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
debug('Listening on ' + bind);
|
||||
}
|
1
backend/server.js.map
Normal file
1
backend/server.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"server.js","sourceRoot":"","sources":["server.ts"],"names":["normalizePort","onError","onListening"],"mappings":"AAAA,0CAA0C;;;QAMtC,KAAK,EACL,GAAG,EAeH,IAAI,EAOJ,MAAM;IAUV;;OAEG;IAEH,uBAAuB,GAAG;QACtBA,IAAIA,IAAIA,GAAGA,QAAQA,CAACA,GAAGA,EAAEA,EAAEA,CAACA,CAACA;QAE7BA,EAAEA,CAACA,CAACA,KAAKA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;YACdA,aAAaA;YACbA,MAAMA,CAACA,GAAGA,CAACA;QACfA,CAACA;QAEDA,EAAEA,CAACA,CAACA,IAAIA,IAAIA,CAACA,CAACA,CAACA,CAACA;YACZA,cAAcA;YACdA,MAAMA,CAACA,IAAIA,CAACA;QAChBA,CAACA;QAEDA,MAAMA,CAACA,KAAKA,CAACA;IACjBA,CAACA;IAED;;OAEG;IAEH,iBAAiB,KAAK;QAClBC,EAAEA,CAACA,CAACA,KAAKA,CAACA,OAAOA,KAAKA,QAAQA,CAACA,CAACA,CAACA;YAC7BA,MAAMA,KAAKA,CAACA;QAChBA,CAACA;QAEDA,IAAIA,IAAIA,GAAGA,OAAOA,IAAIA,KAAKA,QAAQA;cAC7BA,OAAOA,GAAGA,IAAIA;cACdA,OAAOA,GAAGA,IAAIA,CAACA;QAErBA,uDAAuDA;QACv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G,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC;YACrD,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAEtB;;eAEG;YAEC,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAErC;;eAEG;YAEH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACpB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC5B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC"}
|
104
backend/server.ts
Normal file
104
backend/server.ts
Normal file
@ -0,0 +1,104 @@
|
||||
///<reference path="../typings/tsd.d.ts"/>
|
||||
|
||||
import * as _express from 'express';
|
||||
import * as _debug from 'debug';
|
||||
import * as _http from 'http';
|
||||
|
||||
var debug = _debug("PiGallery2:server");
|
||||
var app = _express();
|
||||
|
||||
|
||||
if(process.env.DEBUG) {
|
||||
console.log("Running in DEBUG mode");
|
||||
|
||||
import * as _morgan from 'morgan';
|
||||
app.use(_morgan('dev'));
|
||||
}
|
||||
|
||||
|
||||
app.use(_express.static(__dirname +'./../frontend'));
|
||||
app.use('/node_modules',_express.static(__dirname +'./../node_modules'));
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
var port = normalizePort(process.env.PORT || '3001');
|
||||
app.set('port', port);
|
||||
|
||||
/**
|
||||
* Create HTTP server.
|
||||
*/
|
||||
|
||||
var server = _http.createServer(app);
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
|
||||
function normalizePort(val) {
|
||||
var port = parseInt(val, 10);
|
||||
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
debug('Listening on ' + bind);
|
||||
}
|
||||
|
15
backend/tsconfig.json
Normal file
15
backend/tsconfig.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"sourceMap": false,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"removeComments": false
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"typings"
|
||||
]
|
||||
}
|
16
frontend/app/main.js
Normal file
16
frontend/app/main.js
Normal file
@ -0,0 +1,16 @@
|
||||
System.register(['angular2/platform/browser', './app.component'], function(exports_1) {
|
||||
var browser_1, app_component_1;
|
||||
return {
|
||||
setters:[
|
||||
function (browser_1_1) {
|
||||
browser_1 = browser_1_1;
|
||||
},
|
||||
function (app_component_1_1) {
|
||||
app_component_1 = app_component_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
browser_1.bootstrap(app_component_1.AppComponent);
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=main.js.map
|
1
frontend/app/main.js.map
Normal file
1
frontend/app/main.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";;;;;;;;;;;YAGA,mBAAS,CAAC,4BAAY,CAAC,CAAC"}
|
4
frontend/app/main.ts
Normal file
4
frontend/app/main.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { bootstrap } from 'angular2/platform/browser';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
bootstrap(AppComponent);
|
36
frontend/index.html
Normal file
36
frontend/index.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<script>document.write('<base href="' + document.location + '" />');</script>
|
||||
<meta charset="UTF-8">
|
||||
<title>PiGallery2</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<!-- IE required polyfills, in this exact order -->
|
||||
<script src="../node_modules/es6-shim/es6-shim.min.js"></script>
|
||||
<script src="../node_modules/systemjs/dist/system-polyfills.js"></script>
|
||||
<script src="../node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
|
||||
|
||||
<script src="../node_modules/angular2/bundles/angular2-polyfills.js"></script>
|
||||
<script src="../node_modules/systemjs/dist/system.src.js"></script>
|
||||
<script src="../node_modules/rxjs/bundles/Rx.js"></script>
|
||||
<script src="../node_modules/angular2/bundles/angular2.dev.js"></script>
|
||||
|
||||
<script>
|
||||
System.config({
|
||||
packages: {
|
||||
app: {
|
||||
format: 'register',
|
||||
defaultExtension: 'js'
|
||||
}
|
||||
}
|
||||
});
|
||||
System.import('app/main.js')
|
||||
.then(null, console.error.bind(console));
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<my-app>Loading...</my-app>
|
||||
</body>
|
||||
</html>
|
27
package.json
Normal file
27
package.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "PiGallery2",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./backend/server"
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"angular2": "^2.0.0-beta.9",
|
||||
"debug": "^2.2.0",
|
||||
"es6-promise": "^3.1.2",
|
||||
"es6-shim": "^0.33.13",
|
||||
"express": "^4.13.4",
|
||||
"morgan": "^1.7.0",
|
||||
"reflect-metadata": "^0.1.2",
|
||||
"rxjs": "^5.0.0-beta.2",
|
||||
"socket.io": "^1.4.5",
|
||||
"zone.js": "^0.5.15"
|
||||
},
|
||||
|
||||
"devDependencies": {
|
||||
"typescript": "^1.8.7",
|
||||
"typings": "^0.7.8",
|
||||
"systemjs": "^0.19.24"
|
||||
}
|
||||
}
|
15
tsconfig.json
Normal file
15
tsconfig.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"sourceMap": true,
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"removeComments": false
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"typings"
|
||||
]
|
||||
}
|
15
tsd.json
Normal file
15
tsd.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"express/express.d.ts": {
|
||||
"commit": "0d622d857f97d44ea7dcad2b3edec1f23c48fe9e"
|
||||
},
|
||||
"node/node.d.ts": {
|
||||
"commit": "0d622d857f97d44ea7dcad2b3edec1f23c48fe9e"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user