valetuncle-serverside

valetuncle-serverside is an API for valet uncle mobile application using express js and mysql.

testing IP address: 52.76.211.241
production IP address: 52.76.73.21

  • database:
    • host : 'valetunclelive.crdghclhttrn.ap-southeast-1.rds.amazonaws.com',
    • user : 'vu_userdb',
    • password : 'damn5hitfuck5ake',
    • database : 'valetuncle'

PROMO

POST: /checkPromo

check wether the promocode is valid or invalid

params : x-www-form-urlencoded
    - token: you know this shit
    - username: username that want to use the promocode
    - promocode: put the promocode here
response : {"message":"__"}
    - false :
        promocode invalid/ ""
        promocode exceed it limit
        promocode is not available for today
    - true :
        you know this shit

POST: /getPromo

params : x-www-form-urlencoded
    - promocode: put the promocode here
response : {"message":"__"}
    - you have entered a wrong promo code :
        promocode invalid/ ""
    - object :
        promo with the specify ID you gave

HISTORY

POST: /history

get history from specify ID

params : x-www-form-urlencoded
    - token: you know this shit
    - objecId: you know this shit(2)
response : {"message":"__"}
    - error :
        no history with the ID you gave
    - object :
        history with the specify ID you gave

POST: /toHistory

set status on transaction to finish and put it on table history

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
response : {"message":"__"}
    - Error :
        Error executing MySQL query
    - err.. :
        error doing data mining
    - history Added !:
        history Added

TRANSACTION

POST: /transactionInsert

inserting a transaction

params : x-www-form-urlencoded
    - token: you know this shit
    - username
    - actualLocation
    - promoCode
    - fee
    - notif
    - pickUp
    - remark
    - destinationAddress
    - pickUpAddress
response : {"message":"__"}
    - error
    - success

POST: /updateTransaction

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
    - input: query form client to transaction table
response : {"message":"__"}
    - error :
        Error executing MySQL query
    - success :
        error doing data mining

POST: /driverTemp

get transaction ID where the driverID is equal to the client give as a parameter

params : x-www-form-urlencoded
    - token: you know this shit
    - driverId: you know this shit(2)
response : {"message":"__"}
    - err.. :
        Error executing MySQL query
    - success transactionId :
        there you got the transaction ID

POST: /transaction

get transaction from specify username

params : x-www-form-urlencoded
    - token: you know this shit
    - username: you know this shit(2)
response : {"message":"__"}
    - Error executing MySQL query :
        Error executing MySQL query
    - Success :
        you will got the information on field "Trans"

POST: /getTransaction

check is there any transaction for the driver with the specify ID

params : x-www-form-urlencoded
    - token: you know this shit
    - driverId: you know this shit(2)
response : {"message":"__"}

POST: /getDistance

check is there any transaction for the driver with the specify ID

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
    - driverLoc: driver geolocation
response : {"message":"__"}
    - err..:
    - distance

DELETE: /transaction

check is there any transaction for the driver with the specify ID

params : x-www-form-urlencoded
    - token: you know this shit
    - username: you know this shit(2)
response : {"message":"__"}

POST: /cancelTrans

canceling the transaction, set the transaction status to cancel (not literally delete the transaction) based on username

params : x-www-form-urlencoded
    - token: you know this shit
    - username: you know this shit(2)
response : {"message":"__"}
    - err:
    - successfully delete transaction

POST: /cancelTransaction

canceling the transaction, set the transaction status to cancel (not literally delete the transaction) based on ID

params : x-www-form-urlencoded
    - token: you know this shit
    - username: you know this shit(2)
response : {"message":"__"}
    - err:
    - successfully delete transaction

POST: /cancelDriver

canceling he transaction, set the transaction status to cancel (not literally delete the transaction) based on ID

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
    - reason: you know this shit(3)
response : {"message":"__"}
    - Error executing MySQL query:
    - successfully delete transaction

DRIVER

POST: /driverNotif

push notif android

params : x-www-form-urlencoded
    - token: you know this shit
    - driverId: you know this shit(2)
response : {"message":"__"}

POST: /testNotif

push notif android

params : x-www-form-urlencoded
    - token: you know this shit
    - driverId: you know this shit(2)
response : {"message":"__"}

POST: /driver

get all data from driver from specify ID

params : x-www-form-urlencoded
    - token: you know this shit
    - objectId: you know this shit(2)
response : {"message":"__"}

POST: /driverNumber

get all data from driver from specify ID

params : x-www-form-urlencoded
    - token: you know this shit
    - objectId: you know this shit(2)
response : {"message":"__"}

POST: /checkStartJob

check startJob status on transaction form specify ID

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
response : {"message":"__"}

POST: /checkUsername

check is the usr is already been deleted

params : x-www-form-urlencoded
    - token: you know this shit
    - username: you know this shit(2)
response : {"message":"__"}

POST: /updateRating

params : x-www-form-urlencoded
    - token: you know this shit
    - driverId: you know this shit(2)
    - review:
    - newRating:
response : {"message":"__"}

POST: /review

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
    - review:
response : {"message":"__"}

POST: /setFlag

params : x-www-form-urlencoded
    - token: you know this shit
    - driverId: you know this shit(2)
response : {"message":"__"}

POST: /updateDriver

params : x-www-form-urlencoded
    - token: you know this shit
    - objectId: you know this shit(2)
    - input: query form client to transaction table
response : {"message":"__"}

POST: /imei

check if statusLogin from specify IMEI

params : x-www-form-urlencoded
    - token: you know this shit
    - imei: you know this shit(2)
response : {"message":"__"}

POST: /loginDriver

params : x-www-form-urlencoded
    - token: you know this shit
    - imei: you know this shit(2)
    - idNumber:
response : {"message":"__"}

POST: /getDriverAnswer

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
    - driverId: you know this shit(3)
    - answer:
response : {"message":"__"}

POST: /getDriverAnswer_edit

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
    - driverId: you know this shit(3)
    - answer:
response : {"message":"__"}

POST: /transactionDecline

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
    - driverId: you know this shit(3)
response : {"message":"__"}

POST: /balance

params : x-www-form-urlencoded
    - token: you know this shit
    - driverId: you know this shit(3)
response : {"message":"__"}

POST: /cekDriver

params : x-www-form-urlencoded
    - token: you know this shit
    - driverId: you know this shit(2)
    - transId: you know this shit(3)
response : {"message":"__"}

POST: /checkHere

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(3)
response : {"message":"__"}

POST: /setDriverId

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
response : {"message":"__"}

MULTIDRIVER

POST: /transaction_multipledriver

push notif android

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
response : {"message":"__"}

DELETE: /transaction_multipledriver

push notif android

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
response : {"message":"__"}

POST: /cancelTransMulti

push notif android

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
    - username: you know this shit(2)
response : {"message":"__"}

POST: /transactionInsert_multipledriver

push notif android

params : x-www-form-urlencoded
    - token: you know this shit
    - username:
    - actualLocation: geolocation
    - promocode: you know this shit(2)
response : {"message":"__"}

POST: /checkUsername_multipledriver

push notif android

params : x-www-form-urlencoded
    - token: you know this shit
    - transId: you know this shit(2)
response : {"message":"__"}

How to run it as service on ec2 amazon webservice based on UDEMY video

link: https://www.udemy.com/all-about-nodejs/learn/v4/overview

  1. sudo apt-get install upstart
  2. cd /etc/init
  3. sudo vim appname.conf
description "application name"

start on started mountall
stop on shutdown

respawn
respawn limit 99 5

env NODE_ENV=production

exec node /.. '<app.js location on your server>' >> /var/log/applicationname.log 2>&1
  1. click esc

  2. :wq and enter

  3. then you can just run : sudo start applicationname for running the app

  4. and sudo stop applicationname for stopping the app