-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
46 lines (40 loc) · 911 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict'
/*
|--------------------------------------------------------------------------
| EXAMPLE 1:
|--------------------------------------------------------------------------
|
| Basic configuration (Explicit).
|
*/
const rest_docs = require('./lib/rest.js');
var rest = new rest_docs();
rest.startServer({
ip: '127.0.0.1',
port: '8080'
})
rest.startDBServer('mysql', {
host: 'localhost',
user: 'root',
password: '1234',
database: 'medic_app'
});
const api_config = {
base: '/api',
routes: [
{
// Doctors ['GET', 'POST', 'PUT', 'DELETE']
table: 'doctors',
event: 'DOCTOR',
methods: ['GET', 'POST', 'PUT', 'DELETE'],
columns: [
{name: 'id', primary: true},
{name: 'name'},
{name: 'specialty'},
{name: 'address'},
{name: 'photo'}
]
}
]
}
rest.buildRoutes(api_config)