Quickstart

A quick dive into getting started with Lore

Step 1: Set the API Location

In this step we're going to set the location of the API server.

You can view the finished code for this step by checking out the fetching.1 branch of the completed project.

The Config Folder

At the root of your project is a folder called /config. This folder contains files that expose all the configuration settings for Lore, so that you can tailor the framework's behavior to meet the specific needs of your application.

Navigate into this folder and open a file called connections.js. Toward the top of the connections file you'll see a commented out line that looks like this:

// config/connections.js
...
  default: {

    // apiRoot: 'https://api.example.com',

    ...
  }
...

Commented out lines like this exist across all of the config files, and they reflect the built-in defaults that Lore uses. In this case, this comment tells us that Lore assumes the API is located at https://api.example.com.

Lore is designed to interact with multiple API endpoints. The config settings for each API is called a connection. New projects begin configured for a single API, and this connection is named default.

You can learn more about the connections file here.

Since this is not where our API is located, uncomment that line and change it to http://localhost:1337, so that Lore knows where the API can be found:

// config/connections.js
...
  apiRoot: 'http://localhost:1337',
...

With this change in place, we're almost ready to fetch data.

Visual Check-in

If everything went well, your application should now look like this. Exactly the same as before :)

Code Changes

Below is a list of files modified during this step.

config/connections.js

export default {
  default: {
    apiRoot: 'http://localhost:1337'
  }
};
export default {
  default: {
    apiRoot: 'http://localhost:1337'
  }
}
export default {
  default: {
    apiRoot: 'http://localhost:1337'
  }
}

Next Steps

Next we're going to create our tweet model.