Nothing presented in the issues or in this repo is a final product unless it is marked as such.
The project uses:
- NodeJS JavaScript on the server
- KrakenJS Framework for convention over configuration and security
- MongooseJS Object modeling for MongoDB
- Mockgoose Mocking mongoose connections for unit testing
- MongoDB Highly scalable document based NoSQL database
Make sure you have NodeJS installed (currently, version 0.10.33), and you can use the npm
command:
$ npm version
Install Grunt globally:
$ npm install -g grunt-cli
Then install dependencies from the project root directory:
$ npm install
Running the tests:
$ grunt test
Make sure you have a functional instance of MongoDB installed and running
$ mongo test
MongoDB shell version: 2.6.5
connecting to: test
> exit
bye
If your instance of MongoDB is installed somewhere other than your local machine, you will need to update
config/sandbox.json
and modify themongoConfig
section with your instance details.
Start the server with a grunt task:
$ grunt serve
This will make the application listen on localhost:8000
for requests, and will watch the source code for changes and reload the application as necessary.
Make sure you have modified
config/config.json
with details about your deployment MongoDB instance in themongoConfig
section.
Now you can run a grunt task to build an archive of the application:
$ grunt dist
This task produces dist/hmda-edit-check-api.zip
, which can then be deployed by your continuous integration platform, or manually deployed into your server environment.
This project has defined two Docker containers for your convenience. One for the MongoDB instance, and one for this nodejs project. The MongoDB container is defined in the mongo-docker
directory, while the project container is defined in the Dockerfile
in the project root.
For ease of use, there are two scripts provided to build and run the containers respectively. You can build both Docker images using ./build-docker-containers.sh
and run them with ./run-docker-containers.sh
The project Docker container expects that you'll tag the MongoDB Docker image as hmda-pilot-mongodb
and use --link hmda-pilot-mongodb
when you run it, otherwise, you have to set the following environment variables manually during run:
HMDA_PILOT_MONGODB_HOST
HMDA_PILOT_MONGODB_PORT
If you chose to not use the scripts, you will also have to load the MongoDB instance with data. This is done with a script provided in the API project.
Here is an example of both using the environment variables and running the data loading script:
docker run -d -e "HMDA_PILOT_MONGODB_HOST=my.mongo.server" -e "HMDA_PILOT_MONGODB_PORT=27000" --name hmda-pilot-api -p 8000:8000 hmda-pilot-api
docker exec -it hmda-pilot-api node /usr/local/node/hmda-edit-check-api/data/reload_mongo.js
Documentation of the REST API is maintained within the source code using apiDoc endpoint method comments.
To generate the API documentation, run the grunt task:
$ grunt generate-docs
You can then open './docs/index.html' in your browser to view the API documentation.
For details on how to get involved, please first read our CONTRIBUTING guidelines. This project follows an adapted pull request workflow on top of GitHub, please consult the details before adding features to the project.