- Notifications
You must be signed in to change notification settings - Fork0
Back-end server for use with Udacity's Front-End Frameworks course
License
Alicezhang821/FEF-UdaciMeals-Backbone-Server
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
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.
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.
The server serves web files and provides a REST API. The--www
flagspecifies 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 itemsPUT /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 JSONPUT /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.json
is the storage file. (The file atserver/assets/menu.jsonprovides the starting values and is compiled into the server binary.)
If you want to modify the code or build for another platform:
- Download and install the Go programming language
- Download or clone this project
- Change into the
server
directory - Compile the server:
go build
- Run the
server
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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- Go96.9%
- Shell3.1%