https://github.com/kaizenplatform/doc-search-api
⚠️⚠️⚠️ DEPRECATED
https://github.com/kaizenplatform/doc-search-api
Last synced: about 1 year ago
JSON representation
⚠️⚠️⚠️ DEPRECATED
- Host: GitHub
- URL: https://github.com/kaizenplatform/doc-search-api
- Owner: kaizenplatform
- License: mit
- Created: 2015-03-06T02:07:18.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-09-09T01:49:54.000Z (almost 11 years ago)
- Last Synced: 2024-04-15T00:50:27.562Z (about 2 years ago)
- Language: CoffeeScript
- Homepage: http://ja.ngs.io/2015/03/07/private-middleman-search/
- Size: 173 KB
- Stars: 3
- Watchers: 39
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# doc-search-api
Web API to Search Documentations from Middleman Site
[](https://circleci.com/gh/kaizenplatform/doc-search-api/tree/master)
[](https://heroku.com/deploy)
## Requirements
- Redis
- node
## Configuration
- `TOKEN_SECRET`
- `NODE_ENV`
- `SITEMAP_URL`
## Testing
```bash
npm test
```
## Start server
```
npm start
```
## Endpoints
### Search
```
GET /?q=...&lang=ja
```
### Trigger rebuild index
```
POST /rebuild -d 'token=...×tamp=...'
```
## Example
### Triggering rebuild from Rake task
```rb
desc 'Request rebuilding search index'
task :rebuild_sitemap => [:env] do
if api_base = ENV['DOC_SEARCH_API_BASE']
require 'digest/sha1'
require 'json'
secret = ENV['REBUILD_TOKEN_SECRET']
ts = (Time.now.to_f * 1000).to_i.to_s
token = Digest::SHA1.hexdigest ts + secret
res = %x{curl -XPOST #{api_base}/rebuild -d 'token=#{token}×tamp=#{ts}'}
json = JSON.parse res
raise json['message'] if json['message']
end
end
```
Author
------
[Atsushi Nagase]
License
-------
[MIT License]
[Atsushi Nagase]: http://ngs.io/
[MIT License]: LICENSE