mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-26 18:41:12 -04:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
11 lines
413 B
TypeScript
11 lines
413 B
TypeScript
import {geodbFetch} from 'common/geodb'
|
|
|
|
import {APIHandler} from './helpers/endpoint'
|
|
|
|
export const searchLocation: APIHandler<'search-location'> = async (body) => {
|
|
const {term, limit} = body
|
|
const endpoint = `/cities?namePrefix=${term}&limit=${limit ?? 10}&offset=0&sort=-population`
|
|
// const endpoint = `/countries?namePrefix=${term}&limit=${limit ?? 10}&offset=0`
|
|
return await geodbFetch(endpoint)
|
|
}
|