Coder Social home page Coder Social logo

nevehallon / fef-udacimeals-backbone-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from udacity/fef-udacimeals-backbone-server

0.0 1.0 0.0 8.82 MB

Back-end server for use with Udacity's Front-End Frameworks course

License: Apache License 2.0

Shell 3.11% Go 96.89%

fef-udacimeals-backbone-server's Introduction

Back-End Server for Udacity's Front-End Frameworks course

This server provides support for the Front-End Frameworks coding labs. It both serves the app files and provides a REST interface for reading and storing data.

Running the server

The binaries directory contains builds for Windows, Mac OS X ("darwin"), and Linux. Run the appropriate server program to start the server, supplying the --www= flag to point to your front-end code (e.g. on Mac OS X use ./server_darwin_amd64 --www=../../FEF-UdaciMeals-Backbone)

Use the --log flag to see all of the incoming and outgoing traffic from the server.

Server details

The server serves web files and provides a REST API. The --wwwflag specifies the directory to be served as / (e.g. ./main --www=../web-files serves ../web-files/index.html as /index.html)

The server implements a REST API at /api/items:

  • GET /api/items (no trailing slash) returns an object with a JSON array of menu items
  • PUT /api/items is disallowed (you cannot put the whole array at once)
  • GET /api/items/[id] (e.g. GET /api/items/strawberry-shortcake) gets the menu item with the specified ID and returns it as JSON
  • PUT /api/items/[:id] takes a menu item (JSON format, in the body) and updates the existing item if the ID exists or appends a new one if the ID doesn't exist yet

All of the data is stored in JSON format in the _data directory. menu.json is the storage file. (The file at server/assets/menu.json provides the starting values and is compiled into the server binary.)

Building and running

If you want to modify the code or build for another platform:

  1. Download and install the Go programming language
  2. Download or clone this project
  3. Change into the server directory
  4. Compile the server: go build
  5. Run the server program to start the server.

You can also use the compile.sh script to cross-compile for Windows, Mac OS X, and Linux.

If you want to change the initial data file, install the rice tool from https://github.com/GeertJohan/go.rice, edit server/assets/menu.json, and follow the directions for using embed-go before re-building the binary.

fef-udacimeals-backbone-server's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.