- NestJS
- Mongoose
- 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'],
- Place the
.csv
file in theassets
folder with the namepuzzles_upload.csv
. - Uncomment the
uploadPuzzles
method in the servicepuzzles.service.ts
and the necessary imports. - Uncomment the necessary imports and configurations to initialize the Mongoose module in
src/puzzles/puzzles.module.ts
. - Uncomment the Mongoose imports in
app.module.ts
. - Create a
.env
file at the root of the project with the MongoDB connection string:MONGO_URI=mongodb://localhost:27017/puzzles-db
- Start the project with the command:
npm run start:dev
- Use Postman to send a POST request to the endpoint:
This will start uploading the puzzles to the MongoDB database. The console will notify when the process is complete.
http://[::1]:3000/puzzles/upload
- In the controller
src/puzzles/puzzles.controller.ts
, uncomment thewriteThemes
andwriteOpenings
methods. - In the service
src/puzzles/puzzles.service.ts
, enable the correct return for thegetPuzzlesByThemeFromDB
andgetPuzzlesByOpeningFromDB
methods. - 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
- To generate files by themes: