Skip to content

Integrating nodejs with the current GEAR project, as we transition to GEAR 2.0. Documentation available at: https://github.com/GSA/GEAR-Documentation. Production site: https://ea.gsa.gov

License

Notifications You must be signed in to change notification settings

GSA/GEAR2-NodeJS

Repository files navigation

GEAR2-NodeJS

Installation

Prerequisites

Assumes you have NodeJS (with NPM) installed and appropriate MS SQL configuration params from the GEAR project admin (TBD).

Overview

  1. Clone the repository
  2. Install Node dependencies
  3. Configure the database connection
  4. Start the server

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.

Steps

1. Clone the Repository

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

2. Install Node Dependencies

From your working directory, run the npm install command. This will install all the dependencies listed in package.json.

npm install

3. Configure the Database Connection

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.

4. Start the Server

Finally, now that our database connection is configured, we can test the server.

npm start

Testing

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

About

Integrating nodejs with the current GEAR project, as we transition to GEAR 2.0. Documentation available at: https://github.com/GSA/GEAR-Documentation. Production site: https://ea.gsa.gov

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published