# Getting Started

## Installation

You can install Octoris via npm with

```bash
$ npm i octoris
```

## Core API

Octoris returns an object back which I like to consider the `core api`&#x20;

```javascript
{
  listen,
  methods,
  response,
  router,
  utils,
  debug
}
```

## Full Usage Example

{% code title="index.js" %}

```javascript
const { listen } = require('octoris')
const routes = require('./routes')

listen({ port: 3000 }, routes)
  .then(addr => console.log(`Server Listening on ${addr}`))
  .catch(console.error)
```

{% endcode %}

{% code title="routes.js" %}

```javascript
const { router, response, methods } = require('octoris')
const { send } = response
const { route, fixed, composeRoutes } = router
const { GET } = methods

function homeHandler () {
  return send(200, 'Hello Home!')
}

function aboutHandler () {
  return send(200, 'Hello About!')
}

const home = route([fixed('home')], [
  GET(homeHandler)
])

const about = route([fixed('about')], [
  GET(aboutHandler)
])

module.exports = composeRoutes({ logger: true }, [about, home])
```

{% endcode %}

And now you have a very simple starting server to work with!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://octoris.gitbook.io/octoris/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
