Assumes you have NodeJS (with NPM) installed and appropriate MS SQL configuration params from the GEAR project admin (TBD).
There are different branches for each environment:
- Development - dev-server
- Staging - stage-server
- Production - master
This is to save separate server configurations for each server. Not the best solution but it's a workaround for now.
Start by cloning this repository into a preferred location on your computer.
git clone git@github.com:GSA/GEAR2-NodeJS.git
Once Git is finished, move into the new working directory.
cd GEAR2-NodeJS
From your working directory, run the npm install command. This will install all the dependencies listed in package.json.
npm install
The next step will be to configure the database connection. Before we can do that, we need to add a folder named .securables
to the working directory. This will hold our config file.
mkdir .securables
Our Git repository is already configured to ignore that folder. This gives us a safe place to keep sensitive information such as passwords, tokens, etc.
Now that we have our .securables
folder, we can add our configuration file and set up the database connection. Inside .securables/
, create a new file named, gear-config.js
.
touch .securables/gear-config.js
Then, open gear-config.js
in your preferred code editor and paste the following JavaScript into it...
/* jshint node:true */
'use strict';
module.exports = {
connection: {
user: '',
password: '',
host: '',
database: ''
}
}
};
After the JavaScript is pasted, add the appropriate values for userName
, password
, server
, and database
. You will need to get these from the project admin.
That should be all the information we need to connect to MS SQL, but if needed, other options and more detail can be found in the TediousJS documentation.
Finally, now that our database connection is configured, we can test the server.
npm start
If the server starts up without error, you can try opening the following URL to test the database connection.
http://localhost:3000/api/v0/applications
That URL should respond with a JSON file whose first property is "status":200