File tree 3 files changed +5
-6
lines changed
3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ A complete solution of pgRouting direction Web API written in Node js (Javascrip
4
4
5
5
## Setup
6
6
7
- - edit ` src/config/config.js ` file according to your postgres connection, pgRouting table name and express js settings.
7
+ - edit ` .env ` file according to your postgres connection, pgRouting table name and express js settings.
8
8
9
9
- * if your pgrouting database table schema/name of columns is different, you have to change the query schema in ` src/model/pgrouting.js `
10
10
Original file line number Diff line number Diff line change 20
20
},
21
21
"license" : " MIT" ,
22
22
"dependencies" : {
23
+ "body-parser" : " ^1.19.0" ,
23
24
"cors" : " ^2.8.5" ,
24
25
"express" : " ^4.17.1" ,
25
26
"fb-watchman" : " ^2.0.1" ,
Original file line number Diff line number Diff line change 1
1
const express = require ( 'express' ) ;
2
2
const cors = require ( 'cors' ) ;
3
+ const bodyParser = require ( "body-parser" ) ;
3
4
const { route, closest, distance} = require ( './src/pgRouting' ) ;
4
5
const { exp_config } = require ( './src/config' ) ;
5
6
@@ -12,11 +13,8 @@ const { exp_config } = require('./src/config');
12
13
13
14
const app = express ( ) ;
14
15
// const compiler = webpack(config);
15
- app . use ( cors ( {
16
- origin : ( origin , callback ) => {
17
- callback ( null , true ) ;
18
- } ,
19
- } ) ) ;
16
+ app . use ( cors ( ) ) ;
17
+ app . use ( bodyParser . json ( ) ) ;
20
18
21
19
// use nodemon no need to use webpack-hot-middleware and webpackDevMiddleware for express
22
20
// app.use(webpackDevMiddleware(compiler, {
You can’t perform that action at this time.
0 commit comments