Skip to content

Commit 2c440bf

Browse files
committed
work with hydro
1 parent 534ab40 commit 2c440bf

19 files changed

+81
-488
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
__*
22
node_modules/
3-
config.json
3+
config.js
4+
*.swp
45
.uibuild/

config.sample.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
db_url: 'mongodb://localhost/bbs',
3+
db_name: 'bbs',
4+
ui_path: '.uibuild',
5+
config: {
6+
PORT: 10001, // The port the app will listen on.
7+
/* Fill and uncomment the folling line to enable mail service.
8+
SMTP_HOST: '',
9+
SMTP_PORT: 465,
10+
SMTP_SECURE: true,
11+
SMTP_USER: '',
12+
SMTP_PASS: ''
13+
*/
14+
}
15+
};

development.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,26 @@ process.on('restart', async () => {
1919
});
2020

2121
async function run() {
22-
const hydro = require('./index.js');
22+
const hydro = require('hydro').app;
2323
let config;
2424
try {
25-
config = require('./config.json');
25+
config = require('./config.js');
26+
config.lib = ['@'];
27+
config.handler = ['trace', '@', 'base', 'message', 'user', 'main'];
28+
config.deploy = require('./scripts/deploy.js');
29+
config.app_path = __dirname;
2630
} catch (e) {
27-
config = {};
31+
console.error('Error: Cannot load config');
32+
process.exit(1);
2833
}
2934
global.Hydro = new hydro(config);
3035
await Hydro.load().catch(e => {
3136
console.error('Error loading application:');
3237
console.error(e);
3338
});
34-
await Hydro.listen();
39+
await Hydro.listen().catch(e => {
40+
console.error(e);
41+
});
3542
}
3643

3744
run();

errors.js

-24
This file was deleted.

handlers/main.js handler/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const
22
Router = require('koa-router'),
33
{ ObjectID } = require('bson'),
4-
{ PermissionError } = require('../errors.js'),
4+
{ PermissionError } = require('hydro').errors,
55
{ PERM_THREAD_CREATE, PERM_THREAD_REPLY, PERM_THREAD_DELETE, PERM_REPLY_DELETE } = require('../constants.js');
66

77
module.exports = class HANDLER_MAIN {

handlers/message.js handler/message.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const
22
Router = require('koa-router'),
33
{ ObjectID } = require('bson'),
4-
{ PermissionError, NotFoundError } = require('../errors.js'),
4+
{ PermissionError, NotFoundError } = require('hydro').errors,
55
{ PERM_THREAD_CREATE, PERM_THREAD_REPLY, PERM_THREAD_DELETE, PERM_REPLY_DELETE } = require('../constants.js');
66

77
module.exports = class HANDLER_MAIN {

handlers/base.js

-44
This file was deleted.

handlers/trace.js

-25
This file was deleted.

handlers/user.js

-70
This file was deleted.

index.js

-132
This file was deleted.

lib/config.js

-26
This file was deleted.

0 commit comments

Comments
 (0)