Skip to content

empowerai/fs-middlelayer-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FS ePermit API TravisCI Code Climate Code Climate Coverage Codecov Codacy Badge bitHound Overall Score bitHound Dependencies Gemnasium Dependency Status VersionEye Dependency Status GitHub Tags GitHub Contributors GitHub Issues Semver license

US Forest Service ePermit Middlelayer API

A repository for the development of an API to support the public facing ePermit system to connect to the related Forest Service database, the Special Use Data System (SUDS) located in the National Resource Management System.

This repository is being developed under a task order of the Agile Blanket Purchase Agreement.

Setup

  1. Clone or download this repository.
  2. Run npm install to install application and all dependencies.
  3. Run npm start to start Node.js server.

Configuration

  • Environment variables:

    • PORT | Default: 8000
    • DATABASE_URL | Format: postgres://user:password@host:port/database
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_REGION
    • AWS_BUCKET_NAME
    • SUDS_API_URL
      • To use the moxai dependency and point at the mock API, update this to be http://localhost:${PORT}/mocks.
  • API user account:

    • To create an API user account, run node cmd/createUser.js -u <username> -p <password> -r <userrole>. The user role is either 'user' or 'admin'. The ‘admin’ role has permission to access all routes, but the ‘user’ role does not currently have permission to access any routes.
  • Dotenv:

    • Dotenv is used which can load environment variables from a .env file into process.env
    • Example: PORT=8080

How to Test

  • Scripts
    • Use npm test to run Mocha unit tests.
    • Use npm run coverage for Istanbul code coverage. Results in /coverage folder.
    • Use npm run lint for ESLint static code analysis. Results in /lint folder.
    • Use npm run fix for ESLint code fix.
    • Use npm run dba to run Sequelize migration and seeder.
    • Use npm run doc to run JSDoc code documentation. Results in /docs/code folder and accessed via <application-URL>/docs/code.
  • Data
    • Files: Test files are stored in test/data directory

Dependencies

Refer to application package and dependency trackers for additional dependency information:

The Moxai package is a dependency for testing and was built specifically for this project. Moxai was published as an independent package that can be used with any Express application. This application uses the moxai package as a placeholder mock API. The /mocks/basic.json file maintains the API endpoint schema.

It is known that the api.json file is not strictly valid per the OpenAPI Specification. If this is checked against a validator it will report that it is invalid. We are allowing this to stay invalid because we felt it would be more valuable for developers to have an example data model for permits, rather than have every part of the specification be valid.

Point of Contact and Notifications

You can report issues and submit questions by opening a new Issue in GitHub. You can Watch this repo to receive notifications from GitHub when a new issue is posted, when an existing issue’s status is updated, and when a pull request is created.

Contributing

See CONTRIBUTING for additional information.

Public Domain

This project is in the worldwide public domain. As stated in CONTRIBUTING:

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.