Skip to content

Node.js app that uses Redis to provide an autocomplete API on data that is uploaded as text files

Notifications You must be signed in to change notification settings

glynnbird/simple-autocomplete-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Autocomplete Service

A Node.js app that uses an attached Redis database to provide an autocomplete API for data uploaded as text files. Multiple separate autocomplete indexes are supported.

demo gif

The autocomplete API is CORS-enabled, so that it can be accessed from any web page and conforms to the jQuery autocomplete standard.

API

GET /api

Returns a JSON array of autocomplete indexes that are available

e.g.

[]

or

["animals","trees","actors"]

GET /api/:name?term=

Parameters

  • term - the search term to autocomplete

Returns a JSON array of possible autocompletions

e.g.

["Pedro","Pejman Montazeri","Pepe Reina","Pepe","Per Mertesacker","Peter Odemwingie"]

POST /api/:name

Parameters, one of:

  • file - the text file containing a list of items to be added to the auto-complete index
  • or, url - the url of the file containing a list of items to be added to the auto-complete index

N.B the form type needs to be enctype="multipart/form-data"

DELETE /api/:name

Delete the named autocomplete index.

Lockdown mode

If you have uploaded your content into the Simple Autocomplete Service but now want only the GET /api/:name endpoint to continue working, then you can enable "Lockdown mode".

Simply set an environment variable called LOCKDOWN to true before running the Simple Autocomplete Service:

export LOCKDOWN=true
node app.js

or set a custom environment variable in Bluemix.

This prevents your data being modified until lockdown mode is switched off again, by removing the environment variable.

About

Node.js app that uses Redis to provide an autocomplete API on data that is uploaded as text files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published