Initial commit of production portal folder
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@52744 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
0262f4690c
commit
bad084b3e9
|
@ -38,14 +38,16 @@
|
|||
"@angular/platform-browser-dynamic": "2.0.0",
|
||||
"@angular/platform-server": "2.0.0",
|
||||
"@angular/router": "3.0.0",
|
||||
"angular2-express-engine": "~2.0.11",
|
||||
"angular2-platform-node": "~2.0.11",
|
||||
"angular2-universal": "~2.0.11",
|
||||
"angular2-universal-polyfills": "~2.0.11",
|
||||
"angular2-express-engine": "~2.0.11",
|
||||
"body-parser": "^1.15.2",
|
||||
"express": "^4.14.0",
|
||||
"jquery": "^3.1.1",
|
||||
"methods": "~1.1.2",
|
||||
"rxjs": "5.0.0-beta.12",
|
||||
"uikit": "^3.0.0-beta.18",
|
||||
"zone.js": "0.6.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -70,7 +72,7 @@
|
|||
"ts-loader": "^0.8.2",
|
||||
"ts-node": "^1.3.0",
|
||||
"typescript": "2.0.0",
|
||||
"webpack": "2.1.0-beta.22",
|
||||
"webpack": "^2.1.0-beta.22",
|
||||
"webpack-dev-middleware": "^1.6.1",
|
||||
"webpack-dev-server": "^2.1.0-beta.0",
|
||||
"webpack-merge": "^0.13.0"
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import { Component } from '@angular/core';
|
||||
// import UIkit from 'uikit';
|
||||
// import Icons from 'uikit/dist/js/uikit-icons';
|
||||
|
||||
|
||||
import 'rxjs/Rx';
|
||||
@Component({
|
||||
|
@ -39,7 +42,14 @@ import 'rxjs/Rx';
|
|||
export class App {
|
||||
|
||||
constructor() {
|
||||
// loads the Icon plugin
|
||||
if(typeof document !== undefined) {
|
||||
|
||||
// UIkit.use(Icons);
|
||||
//
|
||||
// // components can be called from the imported UIkit reference
|
||||
// UIkit.notification('Hello world.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,3 +13,12 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="citationDownloader ">
|
||||
|
||||
<select class="select" id="citations" name="citeselect" [(ngModel)]="selectedStyle">
|
||||
<option *ngFor=" let style of styles let i = index" [value]="style">{{style}}</option>
|
||||
</select>
|
||||
<div id="citation" class="box-content"></div>
|
||||
</div>
|
||||
{{citation}}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,7 @@
|
|||
<!--link rel="stylesheet" href="bootstrap/dist/css/bootstrap.min.css"-->
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
|
||||
<script src="assets/lib/citeprocnode.js" type="text/javascript"></script>
|
||||
<!-- Temporarily add here custom style -->
|
||||
<style>
|
||||
.custom-hidden-dropdown-menu {position:static !important;}
|
||||
|
|
|
@ -39,7 +39,13 @@ var clientConfig = {
|
|||
__dirname: true,
|
||||
__filename: true,
|
||||
process: true,
|
||||
Buffer: false
|
||||
Buffer: false,
|
||||
fs: "empty",
|
||||
module: "empty",
|
||||
child_process: "empty",
|
||||
net: "empty",
|
||||
tls: "empty"
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -83,7 +89,13 @@ var serverConfig = {
|
|||
__dirname: true,
|
||||
__filename: true,
|
||||
process: true,
|
||||
Buffer: true
|
||||
Buffer: true,
|
||||
fs: "empty",
|
||||
module: "empty",
|
||||
child_process: "empty",
|
||||
net: "empty",
|
||||
tls: "empty"
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ var cache = (duration) => {
|
|||
}
|
||||
|
||||
|
||||
app.get('/get',cache(10), cors(), (req, res) => {
|
||||
app.get('/get',cache(20), cors(), (req, res) => {
|
||||
setTimeout(() => {
|
||||
const url = (req.query)?req.query.url:null;
|
||||
if (!url){
|
||||
res.status(404).send('Not Found'); //not found
|
||||
res.status(404).send(getResponse(404,"Not Found " +url)) //not found
|
||||
|
||||
}else{
|
||||
request.get(url, function (err, response) {
|
||||
|
@ -43,18 +43,29 @@ app.get('/get',cache(10), cors(), (req, res) => {
|
|||
res.header("Access-Control-Allow-Methods", "GET, OPTIONS");
|
||||
res.header("Access-Control-Allow-Methods", "GET, OPTIONS");
|
||||
res.header("Content-Type","application/json");
|
||||
if (!response && err){
|
||||
res.status(500).send(getResponse(500,"An error occured for " +url))
|
||||
return;
|
||||
}
|
||||
|
||||
if (err) throw err;
|
||||
res.send(response.body);
|
||||
res.status(response.status).send(response.body);
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
app.use((req, res) => {
|
||||
res.status(404).send('Not Found') //not found
|
||||
res.status(404).send(getResponse(404,"Not Found " +url)) //not found
|
||||
})
|
||||
|
||||
app.listen(process.env.PORT, function () {
|
||||
app.listen((process.env.PORT)?process.env.PORT:3000, function () {
|
||||
console.log(`Example app listening on port ${process.env.PORT}!`)
|
||||
})
|
||||
|
||||
function getResponse(code, message){
|
||||
var response ={};
|
||||
response["code"]=code;
|
||||
response["message"]=message;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
8 verbose lifecycle memcache-cache@1.0.0~start: unsafe-perm in lifecycle true
|
||||
9 verbose lifecycle memcache-cache@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/argirok/projects/openaire/uoa-services-portal/trunk/services/cache/mecache/node_modules/.bin:/home/argirok/bin:/home/argirok/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
|
||||
10 verbose lifecycle memcache-cache@1.0.0~start: CWD: /home/argirok/projects/openaire/uoa-services-portal/trunk/services/cache/mecache
|
||||
11 silly lifecycle memcache-cache@1.0.0~start: Args: [ '-c', 'PORT=3000 node cache.js' ]
|
||||
11 silly lifecycle memcache-cache@1.0.0~start: Args: [ '-c', 'PORT=3200 node cache.js' ]
|
||||
12 silly lifecycle memcache-cache@1.0.0~start: Returned: code: 1 signal: null
|
||||
13 info lifecycle memcache-cache@1.0.0~start: Failed to exec start script
|
||||
14 verbose stack Error: memcache-cache@1.0.0 start: `PORT=3000 node cache.js`
|
||||
14 verbose stack Error: memcache-cache@1.0.0 start: `PORT=3200 node cache.js`
|
||||
14 verbose stack Exit status 1
|
||||
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
|
||||
14 verbose stack at emitTwo (events.js:106:13)
|
||||
|
@ -24,19 +24,19 @@
|
|||
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
|
||||
15 verbose pkgid memcache-cache@1.0.0
|
||||
16 verbose cwd /home/argirok/projects/openaire/uoa-services-portal/trunk/services/cache/mecache
|
||||
17 error Linux 4.4.0-97-generic
|
||||
17 error Linux 4.4.0-104-generic
|
||||
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
|
||||
19 error node v7.6.0
|
||||
20 error npm v4.1.2
|
||||
21 error code ELIFECYCLE
|
||||
22 error memcache-cache@1.0.0 start: `PORT=3000 node cache.js`
|
||||
22 error memcache-cache@1.0.0 start: `PORT=3200 node cache.js`
|
||||
22 error Exit status 1
|
||||
23 error Failed at the memcache-cache@1.0.0 start script 'PORT=3000 node cache.js'.
|
||||
23 error Failed at the memcache-cache@1.0.0 start script 'PORT=3200 node cache.js'.
|
||||
23 error Make sure you have the latest version of node.js and npm installed.
|
||||
23 error If you do, this is most likely a problem with the memcache-cache package,
|
||||
23 error not with npm itself.
|
||||
23 error Tell the author that this fails on your system:
|
||||
23 error PORT=3000 node cache.js
|
||||
23 error PORT=3200 node cache.js
|
||||
23 error You can get information on how to open an issue for this project with:
|
||||
23 error npm bugs memcache-cache
|
||||
23 error Or if that isn't available, you can get their info via:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"description": "Caching in memory",
|
||||
"main": "cache.js",
|
||||
"scripts": {
|
||||
"start": "PORT=3000 node cache.js"
|
||||
"start": "PORT=3200 node cache.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"cors": "^2.8.4",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.15.2",
|
||||
"cors": "^2.8.4",
|
||||
"express": "^4.14.0",
|
||||
"multer": "^1.1.0"
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ var express = require("express");
|
|||
var bodyParser = require("body-parser");
|
||||
var multer = require("multer");
|
||||
var app = express();
|
||||
var cors = require('cors')
|
||||
app.use(cors());
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
@ -12,24 +14,16 @@ app.use(function(req, res, next) {
|
|||
next();
|
||||
});
|
||||
|
||||
app.post("/upload", multer({dest: "./uploads/"}).array("uploads[]", 12), function(req, res) {
|
||||
var filepath = __dirname+"/"+req.files[0].path;
|
||||
console.info(req.files[0]);
|
||||
console.info("PAth:::::::"+filepath);
|
||||
|
||||
// var responseData;
|
||||
// fs = require('fs')
|
||||
// fs.readFile(__dirname+"/"+req.files[0].path, 'utf8', function (err,data) {
|
||||
// if (err) {
|
||||
// responseData= "error";
|
||||
// console.log(err);
|
||||
// }
|
||||
// console.log(data);
|
||||
// responseData=data;
|
||||
// });
|
||||
// req.files[0].data=responseData;
|
||||
// res.send(req.files);
|
||||
app.post("/upload", multer({dest: "/home/argirok/projects/openaire/uoa-services-portal/trunk/services/upload/uploads/"}).array("uploads[]", 12), function(req, res) {
|
||||
var filepath ="/"+req.files[0].path;
|
||||
console.log(req.files[0]);
|
||||
if (req.files[0].mimetype != 'text/csv') {
|
||||
console.error("No proper file type");
|
||||
res.status(500).send(getResponse(500,"No proper file type")) ;
|
||||
}else{
|
||||
//send file
|
||||
res.sendFile(filepath);
|
||||
}
|
||||
var fs = require('fs');
|
||||
fs.stat(filepath, function (err, stats) {
|
||||
console.log(stats);//here we got all information of file in stats variable
|
||||
|
@ -51,3 +45,10 @@ app.get('/get/d6bd36a06762e2f0da891f9670fcb2b0', function(req, res) {
|
|||
var server = app.listen(8000, function() {
|
||||
console.log("Listening on port %s...", server.address().port);
|
||||
});
|
||||
function getResponse(code, message){
|
||||
var response ={};
|
||||
response["code"]=code;
|
||||
response["message"]=message;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue