foods

command module
v0.0.0-...-322d0ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2017 License: MIT Imports: 9 Imported by: 0

README

foods

simple website storing favorite foods

dependencies

API

  • GET /foods/<user name> returns a list of the user's favorite foods
  • POST /foods/<user name/<food name> stores new food

The spec says: "Protect your API and differentiate your API's clients with some kind of client token scheme".

I have taken the liberty of introducing user name. Each client has a public name and an authentication token.

each request must include a (base64 encoded) authentication string consisting of the transaction details hashed with the client token.

So a partial URL would be /foods/<user name>?auth=<auth string>

client tokens

The client token serves as a shared secret between the client and server. The token itself is never transmitted.

client tokens for testing are stored in tokens.json in the form

{"Client":"client001","Token":"OlkqktzLs1MPlTHVv7L//ksdAlxbtS3Ui2XAeee8piQ="}

they are generated by the script make_tokens.sh

test

to test this application

  • install_server.sh
  • install_test_client.sh
  • rm /tmp/foods.db (remove database from previous test)
  • run_server.sh (this will block)
  • run_testclient.sh
  • examine the logs /tmp/foods.log, /tmp/tstclient.log

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package auth produces an authenticaton string based on the client token
Package auth produces an authenticaton string based on the client token
Package clienttokens defines the client token scheme
Package clienttokens defines the client token scheme
Package config wraps configuration information
Package config wraps configuration information
Package server manages the http server for the foods system
Package server manages the http server for the foods system
Package storage manages offline storage
Package storage manages offline storage
Package main provides a client for functional tests
Package main provides a client for functional tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL