npm install
to install the dependencies. npm start
to run the application
To get started, make sure you have:
- Node v9.5 or higher installed on your machine.
- A decent code editor like VS Code or Atom.
- Git
Step1: Clone the App To clone the code, navigate to the source directory where you want to maintain the code and via terminal or GUI of your choice, run : git clone https://github.com/OneCommunityGlobal/HGNRest.git . You can also setup SSH and then use that for working with remote.
Step2: Run npm install. Best way is to open the code in the editor and open integrated teminal. Run npm install.
Step3: If running on MacOS or Linux, run npm run prepare-macos-linux
. This will install husky and allow integration with git hooks. Windows users don't need and should not run this command.
Step4: Start the app: To start the app, you need to set up several process.env variables. These variables are:
user=
password=
cluster=
dbName=
replicaSetName=
SentryDSN_URL=
SMTPDomain=
SMTPPass=
SMTPPort=
SMTPUser=
TOKEN_LIFETIME=
TOKEN_LIFETIME_UNITS=<unit like days, second, hours etc>
NODE_ENV= local
| development
| production
JWT_SECRET=
To make the process easy create a .env file and put the above text in the file and replace values with the correct values, which you can get from your teammates. Then do an npm run-script build followed by an npm start. By default, the services will start on port 4500 and you can http://localhost:4500/api/ to access the methods. A tools like Postman will be your best friend here, you will need to have an auth token placed in the 'Authorization' header which you can get through the networking tab of the local frontend when you login.
npm run lint
-- fix lintnpm run build
-- build src server and save in distnpm run buildw
-- auto rebuild upon change of srcnpm run start
-- run the server in distnpm run serve
-- run the server in src without buildnpm run dev
-- run the server in src and auto restart upon change of src
Note: Once you check in the code in github, the application will be publsihed to the following: Developement : https://hgn-rest-dev.herokuapp.com Master: https://hgn-rest.azurewebsites.net/
- Monitoring and logging provided by Sentry.io
- Hosting provided by Microsoft Azure and Heroku
Other key touchpoints:
Build and hosting: Azure and Heroku Monitoring and logging: Sentry.io