# getting started

## Prerequisites

* Node >= `8.0.0`
* NPM >= `5.0.0`

## Install

Install light

```bash
npm install light
```

and add the dev script to your `package.json`.

```javascript
{
  // ...
  "scripts": {
    "start": "light start",
    "dev": "light dev"
  }
  // ...
}
```

## Usage

Once you've installed light, all `.js` files under the `routes` folder will be used to serve pages.

To get started, populate `routes/index.js`.

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

```javascript
const { createRoute } = require('light');

const { route } = createRoute('index');

module.exports = route(() => {
  return {
    hello: 'world',
  };
});
```

{% endcode %}

Run `npm run dev` to start the development server. You should see an output in your terminal similar to the one below.

```
› start      🔥 igniting the server 🔥
› listening  on port 3000
› hmr        starting the hot reloader
› hmr        watching for changes
```

View your resulting website at [localhost:3000](http://localhost:3000)!

## Conclusion

That's it! You now have a dev server that

* hot swaps to speed up development routes
* supports many different serverless and hosting platforms
* has very little magic behind the scenes, what you see in a route is what you get

Feel free to continue with the guides in the sidebar to understand more of the framework!


---

# 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://docs.light.js.org/guides/getting-started.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.
