docs-site/content/0.12.0/api/authentication.md
/*
* Our JavaScript client library works on both the server and the browser.
* When using the library on the browser, please be sure to use the
* search-only API Key rather than the master API key since the latter
* has write access to Typesense and you don't want to expose that.
*/
const Typesense = require('typesense')
let client = new Typesense.Client({
'nodes': [{
'host': 'localhost',
'port': '8108',
'protocol': 'http'
}],
'apiKey': '<API_KEY>',
'connectionTimeoutSeconds': 2
})
import typesense
client = typesense.Client({
'nodes': [{
'host': 'localhost',
'port': '8108',
'protocol': 'http'
}],
'api_key': '<API_KEY>',
'connection_timeout_seconds': 2
})
require 'typesense'
client = Typesense::Client.new(
nodes: [{
host: 'localhost',
port: 8108,
protocol: 'http'
}],
api_key: '<API_KEY>',
connection_timeout_seconds: 2
)
export TYPESENSE_API_KEY='<API_KEY>'
export TYPESENSE_HOST='http://localhost:8108'