2.1.187 • Published 2 years ago

espotz-api v2.1.187

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Espotz-API

Pre-requisites

Getting started

  • Clone the repository
git clone  https://gitlab.com/virtoustack-softwares-pvt-ltd/espotz-api.git
  • Install dependencies
cd espotz-API
npm install
  • Build and run the project
Windows: npm run serve:win
Linux: npm run serve
  • API Base-Url: http://localhost:3000

  • API Document endpoints

    espotz-API: To be updated in future

TypeScript + Node

The repository consist of APIs written in typescript which are used in Espotz project.

Getting TypeScript

Add Typescript to project npm.

npm install -g typescript

Project Structure

The folder structure of this app is explained below:

NameDescription
logContains logs.
node_modulesContains all npm dependencies.
srcContains source code that will be compiled to the dist dir.
src/apiContains controllers and routes.
src/appConfigApplication configuration including environment-specific configs.
src/commonsCommon libraries to be used across your app.
src/modulesContains service classes ad business logic.
src/app.tsContain all express routes, separated by module/area of application.
src/logger.tsContains log4js configurations.
src/redis.connection.tsRedis Connection.
src/server.tsEntry point to express app.
gitlab.ci.ymlContains CICD pipeline code.
dockerfileContains docker build commands.
package.jsonContains npm dependencies as well as build scripts.
tsconfig.jsonConfig settings for compiling source code only written in TypeScript.
tslint.jsonConfig settings for TSLint code style checking.

Running the build

All the different build steps are orchestrated via npm scripts. Npm scripts basically allow us to call (and chain) terminal commands via npm.

Npm ScriptDescription
startRuns full build and runs node on dist/index.js. Can be invoked with npm run start
serveCompiles and runs full project on linux OS. Can be invoked with npm run serve
serve:winCompiles and runs full project on windows OS. Can be invoked with npm run serve:win
buildFull build on linux OS. Can be invoked with npm run build
build:winFull build on Windows OS. Can be invoked with npm run build:win
lint
test
watch-test

TSLint

TSLint is a code linter that helps catch minor code quality and style issues.

TSLint rules

All rules are configured through tslint.json.