/api

Backend api service

Primary LanguageJavaScriptOtherNOASSERTION

GroceryList.io API

Build Status Coverage Status Dependencies Status Dev Dependencies Status

Table of Contents

Getting Started

Install the npm packages described in the package.json and verify that it works:

# Install the dependencies
npm install

# Test
npm test

# Run
npm start

Shut it down manually with Ctrl-C.

Configuration

The configuration file is located in /config/config.js

  • PORT
    • Port the api will listen on.
    • Default: '8080';
  • ENV
    • Environment the application is running in.
    • Default: 'Development'
    • Options: 'Development', 'Test', 'Production'
  • DB
    • Database connection string.
    • Default: 'mongodb://localhost:27017/sgl'
  • JWTSECRET
    • The JWT Secret for authentication.
    • Default: 'sgltestingsecret'

API Endpoints

Swagger:

API is documented using swagger. This is the best way to test api functionality.

/health

  • GET - Returns true is application is running.

/login

  • POST - Get a JWT token from login credentials

/register

  • POST - Create a new user

/lists

  • GET - Return all lists
  • POST - Create or update a list

/lists/{listID}

  • GET - Return a single list
  • PUT - Update a list
  • DELETE - Delete a list

/lists/{listID}/items

  • GET - Return all items
  • DELETE - Delete an item

/lists/{listID}/items/{itemID}

  • GET - Return a single item
  • PUT - Update an item
  • DELETE - Delete an item

Contributing

Fork -> Clone -> Branch -> {CODE} -> Pull Request

All pull requests require passing unit tests via travis and a manual review.

Contribution guidelines for this project

LICENSE

Copyright 2017 Russell Perkins

Licensed under the Attribution-NonCommercial-NoDerivs 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://creativecommons.org/licenses/by-nc-nd/3.0/

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.