File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 4
4
"description" : " An app used to book a flight ticket" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
- "test" : " echo \" Error: no test specified\" && exit 1"
7
+ "start" : " node server/index.js" ,
8
+ "server" : " nodemon server/index.js"
8
9
},
9
10
"repository" : {
10
11
"type" : " git" ,
Original file line number Diff line number Diff line change
1
+ const getDestinationData = require ( '../database/queries/getDestinationData' ) ;
2
+
3
+ exports . getDestinationInfo = ( req , res ) => {
4
+ getDestinationData ( )
5
+ . then ( data => {
6
+ res . json ( data . rows ) ;
7
+ } )
8
+ . catch ( err => console . log ( err ) ) ;
9
+ } ;
Original file line number Diff line number Diff line change 1
1
const express = require ( 'express' ) ;
2
2
const router = express . Router ( ) ;
3
3
4
+ const { getDestinationInfo } = require ( './getDestinationInfo' ) ;
5
+
6
+ router . get ( '/destination' , getDestinationInfo ) ;
7
+
4
8
5
9
module . exports = router ;
Original file line number Diff line number Diff line change 1
1
const dbConnection = require ( './../db_connection' ) ;
2
2
3
- const getDestinationData = country => {
4
- return dbConnection . query ( 'SELECT * FROM destination WHERE country = $1' , [
5
- country
6
- ] ) ;
3
+ const getDestinationData = ( ) => {
4
+ return dbConnection . query ( 'SELECT * FROM destination' ) ;
7
5
} ;
8
6
9
7
module . exports = getDestinationData ;
You can’t perform that action at this time.
0 commit comments