Skip to content

Commit d07ad4d

Browse files
committed
complte code base
1 parent d68a4c8 commit d07ad4d

File tree

10 files changed

+41
-13
lines changed

10 files changed

+41
-13
lines changed

api/dao/uploadDao.js

Lines changed: 0 additions & 6 deletions
This file was deleted.
File renamed without changes.

api/app.js renamed to app/app.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
var express = require('expres');
1+
var express = require('express');
22
var logger = require('morgan');
3-
var bodyParser = require('body-passer');
3+
var bodyParser = require('body-parser');
44
var moment = require('moment');
55
var envConfigs = require('./configs/env');
66
var uploads = require('./routes/uploads');
@@ -25,4 +25,13 @@ app.use('/', function (req, res, next) {
2525
});
2626

2727
//add router
28-
app.use('/upload', upolads)
28+
app.use('/upload', uploads);
29+
30+
var server =app.listen(envConfigs().appPort, function() {
31+
var host = server.address().address;
32+
var port = server.address().port;
33+
console.log(moment().format('YYYY-MM-DD H:mm:ss') + '[server starts]');
34+
console.log('app listening at http://%s:%s', host, port);
35+
});
36+
37+
module.exports = app;
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var path = require('path');
22
module.exports = function() {
33
var envConfig;
4-
envConfig = require(path.join(__dirname, 'config.json'));
4+
envConfig = require(path.join(__dirname, 'configs.json'));
55
return envConfig;
66
}
File renamed without changes.

app/dao/uploadDao.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var client = require('./postgres.js');
2+
module.exports = {
3+
getDatebaseCurrentTime: function(callback) {
4+
client.query("", function (err, result) {
5+
if(err) {
6+
return callback(err, null);
7+
}
8+
if(result.rows.length > 0) {
9+
return callback(null, result.rows[0]);
10+
} else {
11+
return callback(null, null);
12+
}
13+
});
14+
15+
}
16+
}

api/package.json renamed to app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"author": "Nero",
1111
"license": "MIT",
1212
"dependencies": {
13-
"body-passer": "~1.18.2",
13+
"body-parser": "^1.18.3",
1414
"debug": "~4.0.1",
15-
"expres": "~4.15.5",
15+
"express": "~4.16.3",
1616
"morgan": "~1.9.1",
1717
"moment": "~2.19.3",
1818
"multer": "~1.4.0",
File renamed without changes.

docker-compose.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
restart: "always"
55
build: ./app
66
ports:
7-
-"3000:3000"
7+
- "3001:3000"
88
postgres:
99
image: "postgres"
1010
environment:
@@ -15,4 +15,13 @@ services:
1515
- ./postgres/db.sql:/docker-entrypoint-initdb.d/db.sql
1616
ports:
1717
- "5432:5432"
18+
pgadmin:
19+
image: "dpage/pgadmin4"
20+
environment:
21+
PGADMIN_DEFAULT_EMAIL: "nerocube.tw@gmail.com"
22+
PGADMIN_DEFAULT_PASSWORD: "mypass"
23+
links:
24+
- postgres
25+
ports:
26+
- "5050:80"
1827

0 commit comments

Comments
 (0)