Skip to content

gokertanrisever/postcode-api

Repository files navigation

Postcode Search API

  • An example API integration using Typescript, ExpressJS and MongoDB with Mongoose based on UK Postcode format.
  • /api/import accepts csv files and imports data to MongoDB
  • /api/search endpoint accepts lat, long, radius (in meters) parameters and returns matching results

Usage

Rename .env.example file to .env

Running docker compose will create API and MongoDB instances

docker compose up

You can test it at http://localhost:3000

List of Routes

# API Routes:

+--------+-------------------------+
  Method | URI
+--------+-------------------------+
  GET    | /api/healthcheck
  GET    | /api/search
  POST   | /api/import
+--------+-------------------------+

Testing

This command will run tests if docker containers are already up

npm run test

To start docker containers and run tests:

npm run test-build

TODO

  • Add rate limiter
  • API versioning
  • Integrate Swagger

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published