-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
44 lines (33 loc) · 1.63 KB
/
Copy pathserver.js
File metadata and controls
44 lines (33 loc) · 1.63 KB
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
//Install express server
const express = require('express');
const path = require('path');
const db_local = require('./src/routes/queryCommune')
const db_global = require('./src/routes/queryGlobal')
const db_iris = require('./src/routes/queryIRIS')
const db_intercommunale = require ('./src/routes/queryIntercommunale')
var bodyParser = require('body-parser')
const app = express();
app.use(express.static(__dirname + '/dist/dvf'));
app.use(bodyParser.json())
app.use(
bodyParser.urlencoded({
extended: true,
})
)
app.get('/', function(req,res) {
res.sendFile(path.join(__dirname+'/dist/dvf/index.html'));
});
app.get('/api/global/vente/',db_global.vente)
app.get('/api/global/prix_median/',db_global.prixMedian)
app.get('/api/global/stats/',db_global.stats)
// -------------------------------------------------------------------------------------------------------------------------
app.get('/api/intercommunale/vente/:codeinseeepci',db_intercommunale.vente)
app.get('/api/intercommunale/prix_median/:codeinseeepci',db_intercommunale.prixMedian)
app.get('/api/intercommunale/stats/:codeinseeepci',db_intercommunale.stats)
// -------------------------------------------------------------------------------------------------------------------------
app.get('/api/commune/vente/:codeinsee',db_local.vente)
app.get('/api/commune/prix_median/:codeinsee',db_local.prixMedian)
app.get('/api/commune/stats/:codeinsee',db_local.stats)
//--------------------------------------------------------------------------------------------------------------------------
app.post('/api/iris/vente/',db_iris.prixMedian)
app.listen(process.env.PORT || 8080);