This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.coffee
58 lines (49 loc) · 1.88 KB
/
app.coffee
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
47
48
49
50
51
52
53
54
55
56
57
58
require("./logger").init()
logger = require('./logger').logger
logger.use(require('devnull/transports/stream'), {
stream: require('fs').createWriteStream('logger.log')
})
logger.warning "Test"
express = require("express")
routes = require("./routes")
grafic = require("./routes/grafic")
network = require("./routes/network")
system = require("./routes/system")
app = module.exports = express.createServer()
app.configure ->
app.set "views", __dirname + "/views"
app.set "view engine", "ejs"
app.use express.bodyParser()
app.use express.methodOverride()
app.use app.router
app.use express.static(__dirname + "/public")
app.configure "development", ->
app.use express.errorHandler(
dumpExceptions: true
showStack: true
)
app.configure "production", ->
app.use express.errorHandler()
app.get "/", routes.index
app.get "/grafic/getResolutions", grafic.getResolutions
app.get "/grafic/setResolution", grafic.setResolution
#app.post "/grafic", grafic.set
app.get "/network/getGateway", network.getGateway
app.get "/network/getInterfaces", network.getInterfaces
app.get "/network/setGateway", network.setGateway
app.get "/network/setInterface", network.setInterface
app.get "/network/getWlanScan", network.getWlanScan
app.get "/network/scanWlan", network.scanWlan
app.get "/network/getWlanStatus", network.getWlanStatus
app.post "/network/setWlan", network.setWlan
app.get "/network/setDhcp", network.setDhcp
app.get "/system/halt", system.halt
app.get "/system/reboot", system.reboot
app.get "/system/reloadPage", system.reloadPage
app.get "/system/restartBrowser", system.restartBrowser
app.get "/system/getPartitions", system.getPartitions
app.post "/system/copyPartition", system.copyPartition
#Only make the API available on the same machine.
#app.listen 3000, 127.0.0.1
app.listen 3000
console.log "Express server listening on port %d in %s mode", app.address().port, app.settings.env