This project is the “API” part of the Gowento Fullstack Developer Challenge.
It is a RESTful API served using Express, and was bootstrapped with create-esm.
This project uses NPM as a dependency manager.
To get started, you should first install all dependencies:
npm iTo run the API server, use the start script:
npm run startThe API server listens on port 4000.
The API supports:
- the
GETHTTP method only - the JSON output content type only
It exposes two endpoints.
Search for franchisee locations in the database.
| Example Request | Example Response Body |
|---|---|
| GET /locations | [{"name":"Fantastic Plastic Shirt","phone":"0690132287","city":"East Jeanne","postalCode":"93791","countryCode":"FR"},{"name":"Sleek Fresh Computer","phone":"0100933027","city":"Lake Océane","postalCode":"13892","countryCode":"FR"},…] |
| GET /locations?name=cheese | [{"name":"Small Rubber Cheese","phone":"0267073156","city":"Pariston","postalCode":"79909","countryCode":"FR"},{"name":"Fantastic Concrete Cheese","phone":"0245952929","city":"Port Célia","postalCode":"01651","countryCode":"FR"},…] |
Search for postal code information in the database of valid postal codes.
| Example Request | Example Response Body |
|---|---|
| GET /postal-codes | [{"postalCode":"39380","countryCode":"FR"},{"postalCode":"14380","countryCode":"FR"},…] |
| GET /postal-codes?postalCode=91120 | [{"postalCode":"91120","countryCode":"FR"}] |
To run the API in watch mode:
npm run watchTo run the linter against the standard ESLint config used in Gowento projects:
npm run lintTo run all tests:
npm run test