Giter VIP home page Giter VIP logo

chesscolate-puzzles-backend's Introduction

Required Installations

  • NestJS
  • Mongoose

Initial Configuration

  1. Comment out the line that enables CORS in the production server to allow local consumption in the file src/main.ts:
    // Comment this line:
    origin: ['https://chesscolate.com', 'https://www.chesscolate.com'],

Generating Puzzle Files from Lichess .csv

Step 1: Load Puzzles into MongoDB

  1. Place the .csv file in the assets folder with the name puzzles_upload.csv.
  2. Uncomment the uploadPuzzles method in the service puzzles.service.ts and the necessary imports.
  3. Uncomment the necessary imports and configurations to initialize the Mongoose module in src/puzzles/puzzles.module.ts.
  4. Uncomment the Mongoose imports in app.module.ts.
  5. Create a .env file at the root of the project with the MongoDB connection string:
    MONGO_URI=mongodb://localhost:27017/puzzles-db
  6. Start the project with the command:
    npm run start:dev
  7. Use Postman to send a POST request to the endpoint:
    http://[::1]:3000/puzzles/upload
    
    This will start uploading the puzzles to the MongoDB database. The console will notify when the process is complete.

Step 2: Generate Puzzle Files by Themes and Openings

  1. In the controller src/puzzles/puzzles.controller.ts, uncomment the writeThemes and writeOpenings methods.
  2. In the service src/puzzles/puzzles.service.ts, enable the correct return for the getPuzzlesByThemeFromDB and getPuzzlesByOpeningFromDB methods.
  3. Start the file generation process by sending POST requests to the following endpoints:
    • To generate files by themes:
      http://[::1]:3000/puzzles/write-themes
      
    • To generate files by openings:
      http://[::1]:3000/puzzles/write-openings
      

chesscolate-puzzles-backend's People

Contributors

json-alzate avatar

Stargazers

 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.