1.7.7 • Published 6 months ago

navision-proxy-api v1.7.7

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

Introduction

Navision proxy api for both SOAP and REST navision clients.

Currently typescript version is available for bookings api. Bookings api is used for Webook app. API stores data about users, quick forms, bookings templates. Also it fetches and extends data from navision api.

Also this API have endpoints for terminal app (data about loads in vehicles) and for parking app (vehicles and drivers data) which was put on hold.

Getting Started

You can find full application documentation in docs/index.html file.

There is an API documentation in /docs/modules/lib_api_booking.html file.

Install node dependencies with npm install and than you can run API with npm start command.

Migrations

If you changing models you probably will need to create migration to make sure old data fit new models. You can find examples of migrations in lib/db/migrations folder. To run migration run export NODE_ENV=development or export NODE_ENV=production and then node --experimental-specifier-resolution=node --loader ts-node/esm ./lib/db/migrations/<NAME_OF_MIGRATION>.js

Local Development

  1. To local develop a project you need to provide an access to mongodb.

a) You would need to create a tunel to AWS EC2 instance where the you can get an access to development document db. To do so run ssh -i ec2.pem -f -N -L 27017:localhost:27017 ec2-user@34.241.130.126

b) Alternatively you can work with your local instance. You can do it with mongod --fork --syslog --dbpath lib/db/. Than you will also have to customise MONGO_DB_OPTIONS in lib/config.ts for your mongo client.

  1. When importing modules you always should use .js endings for files. TODO: setup this as a linter rule When developing localy you should first run the mongo db with npm run start-mongo and after run project with npm run start:local. Also you haave to be inside AA VPN.

When importing modules you always should use .js endings for files. TODO: setup this as a linter rule

https://stackoverflow.com/questions/62619058/appending-js-extension-on-relative-import-statements-during-typescript-compilat

Publishing

This app is stored as a package on Azure. In order to publish changes in types so it can be recognized in depending apps app needs to be authentificated. See https://dev.azure.com/alex-andersen/Alex%20Andersen/_artifacts/feed/navision-proxy-api/connect/npm. When you want to publish package update you need to run npm version patch|minor|major and than npm publish

Common issues

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-node'

Dev dependecies not installed - switch to NODE_ENV=local or NODE_ENV=production

Invalid XML

Some unknown soap packaging issues. Should work with package-lock.json from commit ced87c33