Quickstart
A quick dive into getting started with Lore
A quick dive into getting started with Lore
In this step we’ll clone and run the API server that we'll need for the rest of this Quickstart.
The server we'll need is in a repository on GitHub under lore/lore-tutorial-api. Run this command to clone the server into your local environment:
$ git clone git@github.com:lore/lore-tutorial-api.git
$ git clone https://github.com/lore/lore-tutorial-api.git
Once the server is cloned, navigate into the directory and install the dependencies:
$ cd lore-tutorial-api
$ npm install
Once the dependencies are installed, stop the mock server (Ctrl+C). We'll need the port it's currently running on (1337) to be free so that the Sails server can bind to it.
Once the mock server is stopped, and port 1337 is free again, start the lore-tutorial-api
server using npm start
. A successful startup will produce console output similar to this:
$ npm start
info:
info: .-..-.
info:
info: Sails <| .-..-.
info: v0.12.14 |\
info: /|.\
info: / || \
info: ,' |' \
info: .-'.-==|/_--'
info: `--'-------'
info: __---___--___---___--___---___--___
info: ____---___--___---___--___---___--___-__
info:
info: Server lifted in `/Users/jchansen/lore/lore-tutorial-api`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press CTRL + C at any time.
debug: -------------------------------------------------------
debug: :: Sun Mar 25 2018 21:21:26 GMT-0700 (MST)
debug: Environment : development
debug: Port : 1337
debug: -------------------------------------------------------
If you now navigate to http://localhost:1337
you will see a webpage showing the API routes:
{
tweets: "http://localhost:1337/tweets",
users: "http://localhost:1337/users",
user: "http://localhost:1337/user"
}
At this point our application no longer works - this is epected. If you refresh your browser, you should see this error in the console:
Expected models to be an array but got [Object {data: Array[5], meta: Object}].
Did you forget to override parse to extract the models?
We'll resolve that issue in the next step and restore our application's functionality.
Next we're going to update our application to work with the new API.