A very basic but thoroughly documented Express API for use in Carrot U API classes.
- MongoDB, a NoSQL database.
- Node.js, a super-speedy environment for writing web applications in JavaScript.
├── README.md
├── lib
│ ├── candy.js The Mongoose `model` for Candy.
│ └── index.js The script run on `start`; includes the routes
and starts the server at the specified port.
└── package.json The metadata used by npm; includes project
dependencies and a `start` script.
- Ensure you have the following prerequisite software installed:
- Node.js: To see if Node.js is installed, run
node -v
; if a version number is returned, you're all set. - MongoDB: To see if MongoDB is installed, run
mongod --version
; if a version number is returned, you're all set.
If either package is missing, install them via Homebrew, an OS X package manager. To be sure Homebrew is installed, run brew -v
; if a version number is returned, you're all set. If the command isn't found, install Homebrew with the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then, install your missing dependencies and follow the instructions output by Homebrew to ensure the software is started now and on login:
-
Node.js:
brew install node
-
MongoDB:
brew install mongo
-
Change into the directory you'd like to clone the project to. For example:
cd ~/Documents
-
Clone the repository:
git clone git@github.com:carrot/carrot-u-api
-
Change into the cloned repository:
cd carrot-u-api
-
Start the server:
npm start
The incredible Amanda Yang (@cutecreep) wrote a Python script for manipulating the API's public instance (carrot-u-api.herokuapp.com). It's located here and includes a README, too!