Skip to content
This repository was archived by the owner on Oct 24, 2019. It is now read-only.

Amazonadonna

lmschmid edited this page Nov 29, 2018 · 13 revisions

Getting Started

First you'll need to install Node. These instructions should work for both Mac OS and Windows.

Starting your server

First run npm install

  • To run the server in a dev environment, run npm start to have tsc transpile and watch your server files and nodemon starts the express server on http://localhost:3000/

Overview

Server.ts serves that html file and any other APIs/routes you may want to add. tsc is used to transpile the back-end typescript into javascript, and nodemon is used to serve the ./dist/server.js file that is generated from tsc.

To build the files, run npm run build which will transpile server.ts to server.js, which can be ran with node ./dist/server.js. (Or run npm run start:prod to do this for you, with the PROD env variable set to true)

Debugging in VS Code

  • Run npm start in a terminal
  • Run the Debug configuration from the debug menu, add breakpoints where needed
  • Use any chrome window to navigate to http://localhost:3000/

Tsconfig files

There are 2 tsconfig files, tsonfig.backend.json which extend tsconfig.json as the base configuration. The tslint extension (see below) only looks for tsconfig.json (as of the time of writing this there is no config option to change that), so all of the linting is done based off of what is in tsconfig.json.

Dev Tooling

The following is a list of optional dev tooling that I included to help my workflow:

  • TSLint: A linter for Typescript. My linting settings are checked into the repo under tslint.json. (Can either be run with npm run lint or use the VSCode extension for in editor linting)
  • Prettier: A formatter to autostyle my code. You need the prettier VSCode extension. Prettier uses .prettierrc.json to set auto-formatting style. Make sure your prettier settings match your tslint settings, for example, tslint.json is set up to never allow semicolons unless necessary, so my .prettierrc.json auto removes semicolons unless necessary.

Components

AWS EC2 (Web Service)

  • Web service which provides cloud computing capacity.
  • Used as a server to handle internal API calls from the front end to DynamoDB.
  • Learn more here.

NodeJS (Web App)

  • Open-source JavaScript run-time environment which executes JavaScript outside of browser
  • Used to implement custom APIs hosted on EC2
  • Learn more here.

DynamoDB (Database)

  • NoSQL database hosted on AWS. Learn more here.
  • Entries are stored as JSON objects and can be queried using the primary key or Global Secondary Indexes.
  • Accessed for read/write on AWS EC2.

Android Studio (UI)

  • Download Android Studio from here.

Espresso (UI Testing)

  • The testing framework is included in the Gradle build files so no other setup required.

Build Environment

npm

  • Build environment for backend server/connection to database. No setup required.

Gradle

  • Build environment for frontend with Android Studio in Kotlin. No setup required.

Travis

  • Travis is linked to this Github repo so no individual setup required. Will build on all push/merge actions.