Urban Nest Server is a REST API Server that serves as a backend to the Web UI urban-nest ui
. This service is a Node based REST server that exposing APIs for reading Brand details, property listing etc.
The server also has a limited write operations that are secured for a logged in user (admin) to write/update properties handled in the website.
All APIs URLs starts with api/{version}/
where the version is the API version, usually specified as v1
, v2
etc.
- Ping - Hearbeat API, returns a Hello message with current date
- Property APIs - APIs that returns one or more properties, a filter can be applied by Property Category (residential/commercial) and status (new/upcoming/completed)
- Admin APIs - Allows to add/update/delete properties
There are minimal configurations for this service specified via config/deploy-config.json
file. You may add or update the configuration key/values under the respective environments. For instance you might change port number from default port of 7009 to something else in this file.
In your developmemt environment, create a file .env
at the root of this project (this file is configured to be ignored while you check-in the code to GitHub) and add the property STAGE=dev
. This will make the service run in development mode.
You may setup development environment by following below pre-reqs and steps to build/run the project
- Node 16.x or later
- Any editor - VScode, Text Editor or Terminal editors
- Docker Desktop for Windows/Mac - for running tests and developing this project in your local environment. The mongodb is run in a docker container. Alternatively you may install mongodb in your local.
- Checkout this git project to your local
- From the root of the project run,
npm install
- To Start the service - From the root of the project run,
npm run dev
Run below targets in a terminal,
npm run swagger
- Generates Swagger REST API docs (OpenAPI v3.0 specification)npm run dev
- Starts the project in watch mode. Any changes in the code makes the server to reloadnpm run build
- Builds the projectnpm run test
- Runs test cases and produced a reportnpm run coverage
- Runs code coveragenpm run copyright
- Checks whether the code files has copyright header else this will add the copyright header for source code files that are added to Gitnpm run upgrade
- Upgrades NPM dependencies to its latest version
If you are developing in this project or writing a client to this project, you may refer the Swagger RESt API docs. Once the project is started, visit http://localhost:<port>/api/v1/docs
.
It is recommended to run the npm run swagger
to produce the latest Swagger API documentation. Once the project is run in dev
mode/stage these APIs can be read via browser using http://<hostname>:<port>/docs
URL i.e. http://localhost:7009/docs
. The swagger APIs are not loaded in Production or Test environments.