Giter Club home page Giter Club logo

real-estate-app's Introduction

NodeJS TypeScript Express.js MongoDB GraphQL Swagger Docker Jest

๐Ÿ˜Ž Read me

Real Estate Rest API in Node.js + Typescrypt + Express.js + MongoDB as a proof of concept.

๐ŸŒŸ Extra features

  • GraphQL - A fun query language for APIs.
  • Docker - To easily run the project with just one command.
  • Jest - To keep the project bug-free.
  • Swagger - To easily test the API with an awesome UI.

๐ŸŽฏ Prerequisites

  • Docker v19.03.0+
  • Node.js v14+
  • NPM v6.X+

๐Ÿš€ Installation

This application runs on a docker compose with his own MongoDB database

Just make sure docker is running (if you don't have it installed, take a look on the official documentation https://docs.docker.com/get-docker/).
Run this command at the root of the project:

Linux/Mac/Windows

docker-compose up -d

The API will run on http://localhost:3021/api/

The database is automatically seeded with test data

So you are ready to test it with an example request of apartments 20KM nearest to the center of Madrid.

Example request:
GET http://localhost:3021/api/apartments/?country=Spain&nearest=20&latitude=40.41829&longitude=-3.70358

๐Ÿ“– Exploring the API

When the application is running, you can explore and test the API with Swagger UI.

You can try it at http://localhost:3021/api/swagger

๐Ÿค” Why not GraphQL?

If you find that working with Rest is boring, this application has a GraphQL endpoint ready to work with the apartments data.

You can try it at http://localhost:3021/api/graphql

Example query:

query {
  apartmentMany {
    name
    description
    price
    address
    city
    country
    rooms
  }
}

๐Ÿ” Running Tests

You can run Jest tests to make sure everything it's working fine, just run at the root of the project:

Linux/Mac/Windows

cd ./real-estate-service
npm install
npm run test

๐Ÿ‘จโ€๐Ÿ’ป Developing locally

If you want to run it without Docker, you first need a MongoDB instance running.

Create a .env file in 'real-estate-service' folder based on the env.example with this command:

Linux/Mac

cd real-estate-service
cp .env.example  .env

Windows

cd real-estate-service
xcopy /I .env.example  .env*

Set up the .env file with your MongoDB credentials and custom ports.

Finally run:

Linux/Mac/Windows

npm install
npm run dev

real-estate-app's People

Contributors

caribbeanwebdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.