-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (25 loc) · 933 Bytes
/
index.js
File metadata and controls
30 lines (25 loc) · 933 Bytes
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
const express = require('express')
const app = express()
const os = require('os')
const bodyParser = require('body-parser')
const api = require('./model/api.js')
app.use(function log (req, res, next) {
console.log([req.method, req.url].join(' '))
next()
})
// app.use(express.static('public'))
// app.set('view engine', 'jade')
app.use(bodyParser.json({limit: '10mb', extended: true}))
app.use(bodyParser.urlencoded({limit: '10mb', extended: true}))
app.get('/', function(req, res) {
res.send("index")
})
api.init("database\\db.nosql", "database\\cache\\")
app.post("/image", api.POST_image)
app.delete("/image", api.DEL_image)
app.get("/image/:user_id/", api.GET_image)
app.get("/image/:user_id/:image_id/", api.GET_image)
app.get("/image/:user_id/:image_id/:subimage_id/", api.GET_image)
var server = app.listen(process.env.PORT || 3000, function() {
console.log('Listening on %s', process.env.PORT || 3000)
})