Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

Alicezhang821/FEF-UdaciMeals-Backbone-Server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Running the server

Thebinaries directory contains builds for Windows, Mac OS X("darwin"), and Linux. Run the appropriateserver 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 trafficfrom the server.

Server details

The server serves web files and provides a REST API. The--wwwflagspecifies the directory to be served as/ (e.g../main --www=../web-filesserves../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 themenu item with the specified ID and returns it as JSON
  • PUT /api/items/[:id] takes a menu item (JSON format, in the body) andupdates the existing item if the ID exists or appends a new one if the IDdoesn't exist yet

All of the data is stored in JSON format in the_data directory.menu.jsonis the storage file. (The file atserver/assets/menu.jsonprovides 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 theserver directory
  4. Compile the server:go build
  5. Run theserver program to start the server.

You can also use thecompile.sh script to cross-compile forWindows, Mac OS X, and Linux.

If you want to change the initial data file, install therice tool fromhttps://github.com/GeertJohan/go.rice,editserver/assets/menu.json, and follow thedirections for usingembed-go before re-building the binary.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go96.9%
  • Shell3.1%

[8]ページ先頭

©2009-2025 Movatter.jp