Search places around you.
GET /places/search?q={queryTerm}&near={city}
Parameters:
queryTerm: what to search for, i.e: "burgers"
city: where to search, i.e: "San Francisco, CA"
GET /places/{id}
Parameters:
id: the Place ID
- serverless: Serverless framework used to package and deploy the service
- serverless-offline: Plugin used to run the API locally
- lambda-api: For serverless projects I prefer to use this package instead of expressjs because it's optimized for AWS Lambda, there are no external dependencies so the final package is smaller. Due to Cold Starts, this is an important feature.
- node-fetch: minimal HTTP client for NodeJS. It's used to interact with Foursquare API.
- jest: for unit testing/mocking
- serverless framework (
npm install -g serverless
) - yarn or npm
- Install packages (just the first time):
yarn
- Update Foursquare credentials on package.json:
This project requires environment variables containing the Foursquare API credentials. Replace the line below on package.json
with the one provided by email:
FOURSQUARE_CLIENT_ID={CLIENT_ID} FOURSQUARE_CLIENT_SECRET={CLIENT_SECRET} sls offline
- Run on localhost:
yarn start
This will start the server on http://localhost:3000/dev . You can start making requests such as:
http://localhost:3000/dev/places/search?q=boba&near=San Francisco, CA
http://localhost:3000/dev/places/58d451f495383907dba37158
- Unit tests
yarn test
[] Retrieve credentials from .env or credentials file
[] Improve unit test coverage
[] Add eslint and prettier