GithubHelp home page GithubHelp logo

articles-search-service's Introduction

Articles service with search engine

This repository contains a web server written in TypeScript using Node.js, Nest.js, MongoDB, Typesense, and containerized with Docker.

Tech

  • NodeJS - JavaScript runtime environment.
  • NestJS - Web framework for NodeJS.
  • Typescript - Strongly typed programming language.
  • MongoDB - Document-oriented database.
  • Typesense - Open source search engine
  • Docker - Open source containerization platform.
  • Nginx - Open-source web server, used in this project as API Gateway

Prerequisites

Before running the server, you need to set some environment variables in the .env file at the root of the cloned repository.

  • MONGODB_URI - MongoDB connection string
  • MONGODB_DB - Name of the database
  • TYPESENSE_URI - Typesense connection string
  • TYPESENSE_API_KEY - Typesense API key (defined in docker-compose)

Installation

  1. Clone or copy the repository.
  2. Navigate to the repository.
  3. Run the Docker container.
docker compose up

The server should now be running on the 80 port.

Usage

This server provides the following endpoints:

  • POST /api/user: Add a new user.
  • GET /api/user/:id: Get user by id
  • GET /api/user: Get all users
  • DELETE /api/user: Delete user
  • POST /api/article: Add a new article.
  • GET /api/article/:id: Get article by id
  • GET /api/article: Get all article
  • DELETE /api/article: Delete article
  • POST /api/comment: Add a new comment.
  • GET /api/comment/:id: Get comment by id
  • GET /api/comment: Get all comments
  • DELETE /api/comment: Delete comment
  • GET api/article/search?text= : Search all articles for provided text

Additional endpoints:

  • POST /api/content/restore: Drop all data and load content from a file
  • POST /api/content/load: Load content from a file to expand the current values

To use the server, you can send HTTP requests to these endpoints. The repository includes an IntelliJ IDEA REST configuration file with sample requests that you can use as a reference.

Misc

Drop database and clear Typesense index

npm run execute drop-db

Load all database records and save stringified

npm run execute save-db

License

This project is licensed under the MIT License.

articles-search-service's People

Contributors

rfist avatar

Watchers

 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.