Skip to content

natyeo/Project_Greenprint_Backend

Repository files navigation

Project Greenprint backend API

Build Status Planet needs saving


API docs

API hosted at

https://project-greenprint-backend.herokuapp.com/

Can be used with the following frontend app:

https://project-greenprint.herokuapp.com/

Journey

POST /

Post request has to contain query parameters in the body of the request formatted as JSON. It must be in the following format:

{
    "from": "_starting_point_",
    "to": "_destination_"
}

On success, the above will return the data back formatted in JSON:

{
    "from": "_starting_point_",
    "to": "_destination_"
}

API local usage

API runs with the following technologies:

API tested with the following frameworks:

Setup

API runs with version 13.5.0 of Node JS. Check node documentation for installation instructions.

Clone repository. Once inside the root folder run the following command to install dependencies.

npm install

Set up environment. Inside the root folder run the following command, modified to include your own API keys, in order to be able to run locally.

touch .env

and then inside the .env file add:

NODE_ENV=development
PORT=5678

GOOGLE_KEY='YOUR_GOOGLE_API_KEY'
CARBON_KEY='YOUR_TRIP_TO_CARBON_API_KEY'
MONGO_ATLAS_KEY = 'YOUR_MONGOATLAS_USER_PASSWORD'
GOOGLE_KEY_EMBED_MAPS="A_SEPARATE_GOOGLE_API_KEY_FOR_EMBEDDED_MAPS" *
BRIGHTER_PLANET_KEY="YOUR_BRIGHTER_PLANET_API_KEY"

*IMPORTANT: ensure that this key is restricted to only receive referrals from the specific frontend app, as the key is included in the url for embedding maps.

To run server locally, type node server.js.

Application will run on localhost:5678

Installing MongoDB

To run the backend database, you need to install MongoDB. For this, just type on your terminal:

brew install mongodb

Nice! The next step is creating our database.

mongo
> use user

Testing

To run tests, navigate to root folder and run command

npm test

Tests are run using the Mocha testing framework!

Team

About

Makers Final Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published