This commit is contained in:
2025-05-21 04:18:42 +03:30
commit d5aff06ada
18 changed files with 4718 additions and 0 deletions

58
.gitignore vendored Normal file
View File

@@ -0,0 +1,58 @@
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
# 0x
profile-*
# mac files
.DS_Store
# vim swap files
*.swp
# webstorm
.idea
# vscode
.vscode
*code-workspace
# clinic
profile*
*clinic*
*flamegraph*

23
README.md Normal file
View File

@@ -0,0 +1,23 @@
# Getting Started with [Fastify-CLI](https://www.npmjs.com/package/fastify-cli)
This project was bootstrapped with Fastify-CLI.
## Available Scripts
In the project directory, you can run:
### `npm run dev`
To start the app in dev mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
### `npm start`
For production mode
### `npm run test`
Run the test cases.
## Learn More
To learn Fastify, check out the [Fastify documentation](https://fastify.dev/docs/latest/).

30
app.js Normal file
View File

@@ -0,0 +1,30 @@
'use strict'
const path = require('node:path')
const AutoLoad = require('@fastify/autoload')
// Pass --options via CLI arguments in command to enable these options.
const options = {}
module.exports = async function (fastify, opts) {
// Place here your custom code!
// Do not touch the following lines
// This loads all plugins defined in plugins
// those should be support plugins that are reused
// through your application
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'plugins'),
options: Object.assign({}, opts)
})
// This loads all plugins defined in routes
// define your routes in one of these
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'routes'),
options: Object.assign({}, opts)
})
}
module.exports.options = options

View File

@@ -0,0 +1,967 @@
[
{
"carName": "آریسان ۲",
"marketPrice": "581,۰۰۰,۰۰۰",
"newCarPrice": "553,۰۰۰,۰۰۰"
},
{
"carName": "پژو ۲۰۷ اتوماتیک",
"marketPrice": "996,۰۰۰,۰۰۰",
"newCarPrice": "779,۰۰۰,۰۰۰"
},
{
"carName": "پژو ۲۰۷ اتوماتیک - پانوراما",
"marketPrice": "1,۰۶۶,۰۰۰,۰۰۰",
"newCarPrice": "805,۷۰۲,۰۰۰"
},
{
"carName": "پژو ۲۰۷ دنده ای - پانوراما",
"marketPrice": "897,۰۰۰,۰۰۰",
"newCarPrice": "684,۰۹۲,۰۰۰"
},
{
"carName": "پژو ۲۰۷ دنده ای - فرمان هیدرولیک",
"marketPrice": "804,۰۰۰,۰۰۰",
"newCarPrice": "625,۸۲۲,۰۰۰"
},
{
"carName": "پژو ۲۰۷ موتور TU3",
"marketPrice": "733,۰۰۰,۰۰۰",
"newCarPrice": "598,۵۶۰,۰۰۰"
},
{
"carName": "پژو پارس",
"marketPrice": null,
"newCarPrice": "445,۷۴۲,۳۰۰"
},
{
"carName": "پژو پارس TU5",
"marketPrice": null,
"newCarPrice": "480,۵۰۰,۰۰۰"
},
{
"carName": "پژو پارس سفارسی ELX",
"marketPrice": null,
"newCarPrice": "524,۱۵۸,۰۰۰"
},
{
"carName": "تارا اتوماتیک - V4",
"marketPrice": "1,۱۲۷,۰۰۰,۰۰۰",
"newCarPrice": "912,۱۶۵,۰۰۰"
},
{
"carName": "تارا دنده ای - V1 پلاس",
"marketPrice": "909,۰۰۰,۰۰۰",
"newCarPrice": "784,۷۴۲,۰۰۰"
},
{
"carName": "دنا پلاس اتوماتیک توربو - آپشنال",
"marketPrice": "1,۱۷۰,۰۰۰,۰۰۰",
"newCarPrice": "955,۹۷۲,۰۰۰"
},
{
"carName": "دنا پلاس جوانان",
"marketPrice": null,
"newCarPrice": "591,۸۰۰,۰۰۰"
},
{
"carName": "دنا پلاس دنده ای - ۶ سرعته",
"marketPrice": "954,۰۰۰,۰۰۰",
"newCarPrice": "758,۶۴۲,۰۰۰"
},
{
"carName": "رانا پلاس",
"marketPrice": null,
"newCarPrice": "607,۷۲۲,۷۰۰"
},
{
"carName": "ری را ",
"marketPrice": "1,۶۰۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۱۴۲,۴۷۷,۰۰۰"
},
{
"carName": "سورن پلاس ",
"marketPrice": "933,۰۰۰,۰۰۰",
"newCarPrice": "644,۳۷۰,۰۰۰"
},
{
"carName": "سورن پلاس - XU7P",
"marketPrice": "705,۰۰۰,۰۰۰",
"newCarPrice": "626,۵۲۰,۰۰۰"
},
{
"carName": "سورن پلاس دوگانه سوز",
"marketPrice": "826,۰۰۰,۰۰۰",
"newCarPrice": "661,۵۰۹,۰۰۰"
},
{
"carName": "فوتون تونلند G7",
"marketPrice": "2,۸۷۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۲۵,۰۰۰,۰۰۰"
},
{
"carName": "لونا برقی",
"marketPrice": "1,۱۴۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۱۷۸,۷۷۵,۰۰۰"
},
{
"carName": "هایما 7X",
"marketPrice": "2,۰۲۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۵۶۳,۰۰۰,۰۰۰"
},
{
"carName": "هایما ۸S",
"marketPrice": "2,۰۸۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۳۹۸,۱۹۹,۰۰۰"
},
{
"carName": "هایما S5",
"marketPrice": "1,۶۷۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۱۸۳,۰۰۰,۰۰۰"
},
{
"carName": "هایما S7",
"marketPrice": null,
"newCarPrice": "1,۱۹۰,۶۶۴,۰۰۰"
},
{
"carName": "هایما S7 پرو",
"marketPrice": "1,۸۴۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۴۱۱,۰۰۰,۰۰۰"
},
{
"carName": "اطلس G",
"marketPrice": "625,۰۰۰,۰۰۰",
"newCarPrice": "502,۲۱۱,۰۰۰"
},
{
"carName": "اطلس پلاس اتوماتیک",
"marketPrice": null,
"newCarPrice": "595,۰۰۰,۰۰۰"
},
{
"carName": "سایپا ۱۵۱",
"marketPrice": "410,۰۰۰,۰۰۰",
"newCarPrice": "408,۹۳۵,۰۰۰"
},
{
"carName": "سایپا ۱۵۱ - لاینر",
"marketPrice": "414,۰۰۰,۰۰۰",
"newCarPrice": "414,۴۳۲,۰۰۰"
},
{
"carName": "ساینا GX",
"marketPrice": null,
"newCarPrice": "413,۴۷۳,۰۰۰"
},
{
"carName": "ساینا S",
"marketPrice": "500,۰۰۰,۰۰۰",
"newCarPrice": "414,۴۳۹,۰۰۰"
},
{
"carName": "ساینا S اتوماتیک",
"marketPrice": "640,۰۰۰,۰۰۰",
"newCarPrice": "494,۳۳۷,۰۰۰"
},
{
"carName": "ساینا S دوگانه سوز",
"marketPrice": "590,۰۰۰,۰۰۰",
"newCarPrice": "450,۳۸۸,۰۰۰"
},
{
"carName": "سهند G",
"marketPrice": "682,۰۰۰,۰۰۰",
"newCarPrice": "524,۳۵۵,۰۰۰"
},
{
"carName": "سهند S",
"marketPrice": "585,۰۰۰,۰۰۰",
"newCarPrice": "467,۲۰۲,۰۰۰"
},
{
"carName": "شاهین اتوماتیک",
"marketPrice": "934,۰۰۰,۰۰۰",
"newCarPrice": "739,۶۵۵,۰۰۰"
},
{
"carName": "شاهین اتوماتیک پلاس",
"marketPrice": "1,۲۲۰,۰۰۰,۰۰۰",
"newCarPrice": "862,۲۹۰,۰۰۰"
},
{
"carName": "شاهین ESP - G",
"marketPrice": "887,۰۰۰,۰۰۰",
"newCarPrice": "593,۸۴۲,۰۰۰"
},
{
"carName": "شاهین GL",
"marketPrice": "811,۰۰۰,۰۰۰",
"newCarPrice": "565,۰۰۰,۰۰۰"
},
{
"carName": "کوییک اتوماتیک",
"marketPrice": "683,۰۰۰,۰۰۰",
"newCarPrice": "478,۱۱۵,۰۰۰"
},
{
"carName": "کوییک GXL",
"marketPrice": "489,۰۰۰,۰۰۰",
"newCarPrice": "439,۱۸۸,۰۰۰"
},
{
"carName": "کوییک GXR-L",
"marketPrice": "512,۰۰۰,۰۰۰",
"newCarPrice": "450,۶۵۵,۰۰۰"
},
{
"carName": "کوییک R تیپ S",
"marketPrice": null,
"newCarPrice": "412,۸۰۰,۰۰۰"
},
{
"carName": "کوییک S",
"marketPrice": "480,۰۰۰,۰۰۰",
"newCarPrice": "405,۷۶۵,۰۰۰"
},
{
"carName": "وانت زامیاد",
"marketPrice": "750,۰۰۰,۰۰۰",
"newCarPrice": "591,۰۰۰,۰۰۰"
},
{
"carName": "وانت زامیاد گازسوز",
"marketPrice": "785,۰۰۰,۰۰۰",
"newCarPrice": "647,۰۰۰,۰۰۰"
},
{
"carName": "اکستریم LX",
"marketPrice": "2,۹۳۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۶۹۵,۰۰۰,۰۰۰"
},
{
"carName": "اکستریم TXL",
"marketPrice": "4,۰۰۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۶۴۰,۰۰۰,۰۰۰"
},
{
"carName": "اکستریم VX",
"marketPrice": "5,۰۰۰,۰۰۰,۰۰۰",
"newCarPrice": "4,۵۰۰,۰۰۰,۰۰۰"
},
{
"carName": "ام وی ام آریزو ۵ اسپرت (FL)",
"marketPrice": "1,۶۲۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۴۳۷,۲۰۰,۰۰۰"
},
{
"carName": "ام وی ام X22 پرو دنده ای",
"marketPrice": "1,۰۵۷,۰۰۰,۰۰۰",
"newCarPrice": "1,۰۷۰,۸۰۰,۰۰۰"
},
{
"carName": "ام وی ام X33 کراس اتوماتیک",
"marketPrice": "1,۲۹۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۲۱۷,۱۰۰,۰۰۰"
},
{
"carName": "ام وی ام X33 کراس دنده ای",
"marketPrice": "1,۱۳۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۰۶۲,۳۰۰,۰۰۰"
},
{
"carName": "ام وی ام X55 پرو",
"marketPrice": "1,۷۰۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۶۸۷,۰۰۰,۰۰۰"
},
{
"carName": "فونیکس آریزو ۶ GT",
"marketPrice": "2,۲۲۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۸۷۱,۶۰۰,۰۰۰"
},
{
"carName": "فونیکس آریزو ۶ پرو",
"marketPrice": "1,۹۵۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۶۲۸,۹۰۰,۰۰۰"
},
{
"carName": "فونیکس آریزو ۸",
"marketPrice": "2,۹۸۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۳۰,۰۰۰,۰۰۰"
},
{
"carName": "فونیکس FX برقی",
"marketPrice": null,
"newCarPrice": "2,۳۱۴,۰۰۰,۰۰۰"
},
{
"carName": "فونیکس FX پرمیوم",
"marketPrice": "2,۴۹۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۴۸۳,۱۰۰,۰۰۰"
},
{
"carName": "فونیکس FX پرمیوم - دو دیفرانسیل",
"marketPrice": "2,۵۹۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۴۸۹,۰۰۰,۰۰۰"
},
{
"carName": "فونیکس تیگو ۷ پرو e پلاس",
"marketPrice": "2,۶۸۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۶۴,۰۰۰,۰۰۰"
},
{
"carName": "فونیکس تیگو ۷ پرو پرمیوم",
"marketPrice": null,
"newCarPrice": "1,۷۳۰,۳۰۰,۰۰۰"
},
{
"carName": "فونیکس تیگو ۷ پرومکس",
"marketPrice": "2,۵۵۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۰۴,۰۰۰,۰۰۰"
},
{
"carName": "فونیکس تیگو ۷ پرومکس - دو دیفرانسیل ",
"marketPrice": "2,۶۹۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۷۲,۲۰۰,۰۰۰"
},
{
"carName": "فونیکس تیگو ۸ پرو e پلاس",
"marketPrice": "3,۳۴۵,۰۰۰,۰۰۰",
"newCarPrice": "3,۳۰۲,۷۰۰,۰۰۰"
},
{
"carName": "فونیکس تیگو ۸ پرو مکس IE",
"marketPrice": "3,۶۲۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۳۷۷,۵۰۰,۰۰۰"
},
{
"carName": "جک J4",
"marketPrice": "970,۰۰۰,۰۰۰",
"newCarPrice": "932,۰۰۰,۰۰۰"
},
{
"carName": "جک S3",
"marketPrice": null,
"newCarPrice": "1,۰۸۰,۰۰۰,۰۰۰"
},
{
"carName": "کی ام سی A5",
"marketPrice": "1,۹۰۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۶۵۸,۰۰۰,۰۰۰"
},
{
"carName": "کی ام سی ایگل",
"marketPrice": null,
"newCarPrice": "992,۰۰۰,۰۰۰"
},
{
"carName": "کی ام سی EJ7",
"marketPrice": "1,۳۲۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۴۵۰,۰۰۰,۰۰۰"
},
{
"carName": "کی ام سی EJ7 پلاس",
"marketPrice": null,
"newCarPrice": "1,۹۵۰,۰۰۰,۰۰۰"
},
{
"carName": "کی ام سی J7",
"marketPrice": "1,۹۷۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۶۶۲,۰۰۰,۰۰۰"
},
{
"carName": "کی ام سی T8",
"marketPrice": "1,۹۸۵,۰۰۰,۰۰۰",
"newCarPrice": "2,۱۱۰,۰۰۰,۰۰۰"
},
{
"carName": "کی ام سی T9",
"marketPrice": "2,۹۱۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۲۵,۰۰۰,۰۰۰"
},
{
"carName": "کی ام سی X5",
"marketPrice": "1,۹۵۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۴۰,۰۰۰,۰۰۰"
},
{
"carName": "پیکاپ G9",
"marketPrice": "2,۹۳۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۹۸,۳۰۰,۰۰۰"
},
{
"carName": "دیگنیتی پرایم - سفید داخل مارون",
"marketPrice": "1,۹۱۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۶۱۵,۰۹۳,۰۰۰"
},
{
"carName": "دیگنیتی پرایم - سفید داخل مشکی",
"marketPrice": "1,۸۸۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۶۱۵,۰۹۳,۰۰۰"
},
{
"carName": "دیگنیتی پرایم - مشکی داخل مارون",
"marketPrice": "1,۹۵۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۶۱۵,۰۹۳,۰۰۰"
},
{
"carName": "دیگنیتی پرایم - مشکی داخل مشکی",
"marketPrice": "1,۹۳۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۶۱۵,۰۹۳,۰۰۰"
},
{
"carName": "دیگنیتی پرستیژ - سفید داخل مارون",
"marketPrice": null,
"newCarPrice": "2,۰۴۰,۰۰۰,۰۰۰"
},
{
"carName": "دیگنیتی پرستیژ - سفید داخل مشکی",
"marketPrice": null,
"newCarPrice": "2,۰۴۰,۰۰۰,۰۰۰"
},
{
"carName": "دیگنیتی پرستیژ - مشکی داخل مارون",
"marketPrice": null,
"newCarPrice": "2,۰۴۰,۰۰۰,۰۰۰"
},
{
"carName": "دیگنیتی پرستیژ - مشکی داخل مشکی",
"marketPrice": null,
"newCarPrice": "2,۰۴۰,۰۰۰,۰۰۰"
},
{
"carName": "ریسپکت - تیپ ۲",
"marketPrice": "1,۵۸۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۳۷۹,۳۰۰,۰۰۰"
},
{
"carName": "فیدلیتی الیت ۵ نفره",
"marketPrice": "2,۱۳۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۲۴,۷۳۱,۰۰۰"
},
{
"carName": "فیدلیتی الیت ۷ نفره",
"marketPrice": "2,۱۷۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۵۷,۴۱۰,۰۰۰"
},
{
"carName": "فیدلیتی پرایم ۵ نفره - سفید",
"marketPrice": "2,۰۹۳,۰۰۰,۰۰۰",
"newCarPrice": "1,۵۱۵,۲۰۰,۰۰۰"
},
{
"carName": "فیدلیتی پرایم ۵ نفره - مشکی",
"marketPrice": "2,۰۹۷,۰۰۰,۰۰۰",
"newCarPrice": "1,۵۱۵,۲۰۰,۰۰۰"
},
{
"carName": "فیدلیتی پرایم ۷ نفره - سفید",
"marketPrice": "2,۱۱۷,۰۰۰,۰۰۰",
"newCarPrice": "1,۵۳۳,۱۰۰,۰۰۰"
},
{
"carName": "فیدلیتی پرایم ۷ نفره - مشکی",
"marketPrice": "2,۱۲۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۵۳۳,۱۰۰,۰۰۰"
},
{
"carName": "فیدلیتی پرستیژ ۵ نفره ",
"marketPrice": "3,۰۲۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۸۹۰,۴۱۸,۰۰۰"
},
{
"carName": "فیدلیتی پرستیژ ۷ نفره ",
"marketPrice": "3,۰۸۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۹۲۹,۱۲۳,۰۰۰"
},
{
"carName": "ون اینرودز",
"marketPrice": "870,۰۰۰,۰۰۰",
"newCarPrice": "957,۴۶۰,۰۰۰"
},
{
"carName": "بک X3 پرو",
"marketPrice": "1,۳۳۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۰۵۰,۰۰۰,۰۰۰"
},
{
"carName": "تیارا پرایم - بیجینگ X7",
"marketPrice": null,
"newCarPrice": "2,۱۰۴,۰۰۰,۰۰۰"
},
{
"carName": "لوکانو L7",
"marketPrice": "2,۹۵۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۹۵۰,۰۰۰,۰۰۰"
},
{
"carName": "مکث تیارا",
"marketPrice": null,
"newCarPrice": "1,۳۴۱,۵۰۰,۰۰۰"
},
{
"carName": "مکث کلوت اتوماتیک",
"marketPrice": "1,۸۶۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۲۸۹,۰۰۰,۰۰۰"
},
{
"carName": "سوبا M4",
"marketPrice": null,
"newCarPrice": "3,۳۰۰,۰۰۰,۰۰۰"
},
{
"carName": "فردا ۵۱۱",
"marketPrice": "1,۰۹۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۱۰۰,۰۰۰,۰۰۰"
},
{
"carName": "فردا SX5",
"marketPrice": "1,۴۹۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۲۹۰,۰۰۰,۰۰۰"
},
{
"carName": "فردا T5",
"marketPrice": "1,۷۸۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۹۰,۰۰۰,۰۰۰"
},
{
"carName": "لاماری ایما - سفید",
"marketPrice": "2,۱۶۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۰۱,۴۰۰,۰۰۰"
},
{
"carName": "لاماری ایما - مشکی",
"marketPrice": "2,۱۷۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۰۱,۴۰۰,۰۰۰"
},
{
"carName": "پیکاپ موسو گرند خان - تیپ SAHARA",
"marketPrice": null,
"newCarPrice": "2,۶۹۰,۰۰۰,۰۰۰"
},
{
"carName": "پیکاپ موسو گرند خان - تیپ SIGNATURE",
"marketPrice": null,
"newCarPrice": "3,۱۹۰,۰۰۰,۰۰۰"
},
{
"carName": "دایون Y7",
"marketPrice": null,
"newCarPrice": "1,۹۹۸,۰۰۰,۰۰۰"
},
{
"carName": "تیگارد X35",
"marketPrice": "1,۶۱۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۳۵۰,۰۰۰,۰۰۰"
},
{
"carName": "ترا",
"marketPrice": "4,۶۷۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۲۵۰,۰۰۰,۰۰۰"
},
{
"carName": "مکسوس استار H",
"marketPrice": null,
"newCarPrice": "2,۹۸۵,۰۰۰,۰۰۰"
},
{
"carName": "کرولا کراس هیبرید",
"marketPrice": "4,۳۶۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۴۵,۰۰۰,۰۰۰"
},
{
"carName": "BZ3 - الیت پرو ",
"marketPrice": null,
"newCarPrice": "2,۵۴۳,۰۰۰,۰۰۰"
},
{
"carName": "BZ4X - پرو",
"marketPrice": "5,۴۹۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۴۲۰,۶۰۰,۰۰۰"
},
{
"carName": "BZ4X - مکس",
"marketPrice": null,
"newCarPrice": "4,۲۷۷,۹۸۸,۰۰۰"
},
{
"carName": "کرولا ۱.۲ بنزینی",
"marketPrice": "2,۷۱۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۴۹۳,۰۰۰,۰۰۰"
},
{
"carName": "کرولا ۱.۸ هیبرید",
"marketPrice": null,
"newCarPrice": "2,۳۰۵,۰۰۰,۰۰۰"
},
{
"carName": "کرولا ۱.۸ هیبرید - تیپ الیت",
"marketPrice": null,
"newCarPrice": "2,۰۱۳,۴۹۹,۰۰۰"
},
{
"carName": "لوین ۱.۲ بنزینی",
"marketPrice": "2,۶۷۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۷۵,۰۰۰,۰۰۰"
},
{
"carName": "لوین ۱.۸ هیبرید",
"marketPrice": "3,۰۴۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۷۵,۰۰۰,۰۰۰"
},
{
"carName": "اسپورتیج",
"marketPrice": "5,۷۵۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۸۳۴,۰۰۰,۰۰۰"
},
{
"carName": "K5",
"marketPrice": null,
"newCarPrice": "2,۵۹۸,۰۰۰,۰۰۰"
},
{
"carName": "K5 توربو",
"marketPrice": "5,۵۵۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۰۵۸,۰۰۰,۰۰۰"
},
{
"carName": "سراتو",
"marketPrice": "3,۷۶۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۷۵۰,۰۰۰,۰۰۰"
},
{
"carName": "سلتوس",
"marketPrice": null,
"newCarPrice": "2,۶۲۰,۰۰۰,۰۰۰"
},
{
"carName": "سلتوس توربو",
"marketPrice": "3,۸۳۵,۰۰۰,۰۰۰",
"newCarPrice": "2,۶۲۵,۰۰۰,۰۰۰"
},
{
"carName": "سونت",
"marketPrice": "2,۸۵۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۰۰,۰۰۰,۰۰۰"
},
{
"carName": "سانی",
"marketPrice": null,
"newCarPrice": "1,۳۵۰,۰۰۰,۰۰۰"
},
{
"carName": "سیلفی",
"marketPrice": null,
"newCarPrice": "2,۴۴۰,۰۰۰,۰۰۰"
},
{
"carName": "سیلفی مکس ادیشن",
"marketPrice": "3,۷۴۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۵۰,۰۰۰,۰۰۰"
},
{
"carName": "قشقایی",
"marketPrice": "3,۴۹۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۱۰۸,۰۰۰,۰۰۰"
},
{
"carName": "کیکس",
"marketPrice": "2,۹۶۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۴۷۵,۰۰۰,۰۰۰"
},
{
"carName": "اکسنت",
"marketPrice": "2,۱۹۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۸۶۵,۰۰۰,۰۰۰"
},
{
"carName": "النترا",
"marketPrice": "2,۶۵۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۲۰۰,۰۰۰,۰۰۰"
},
{
"carName": "توسان",
"marketPrice": "4,۳۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۴۵۰,۰۰۰,۰۰۰"
},
{
"carName": "کرتا",
"marketPrice": "2,۸۹۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۲۲۰,۰۰۰,۰۰۰"
},
{
"carName": "کونا",
"marketPrice": "4,۱۰۰,۰۰۰,۰۰۰",
"newCarPrice": "4,۵۹۲,۰۰۰,۰۰۰"
},
{
"carName": "ID4",
"marketPrice": "3,۷۰۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۲۴۰,۰۰۰,۰۰۰"
},
{
"carName": "تیراک ",
"marketPrice": "4,۴۱۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۹۴۵,۰۰۰,۰۰۰"
},
{
"carName": "Q5 ای ترون",
"marketPrice": "5,۵۳۰,۰۰۰,۰۰۰",
"newCarPrice": "5,۶۵۷,۰۰۰,۰۰۰"
},
{
"carName": "بالنو",
"marketPrice": "1,۹۹۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۴۰,۰۰۰,۰۰۰"
},
{
"carName": "جیمنی ۵ در",
"marketPrice": "2,۹۶۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۸۷۰,۰۰۰,۰۰۰"
},
{
"carName": "سیاز",
"marketPrice": "1,۹۸۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۲۰,۰۰۰,۰۰۰"
},
{
"carName": "فرانکس",
"marketPrice": "2,۷۷۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۰۰۰,۰۰۰,۰۰۰"
},
{
"carName": "ویتارا تک دیفرانسیل",
"marketPrice": "3,۶۱۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۴۰,۰۰۰,۰۰۰"
},
{
"carName": "امپو",
"marketPrice": "2,۹۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۱۸۳,۵۰۰,۰۰۰"
},
{
"carName": "امکو",
"marketPrice": "3,۲۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۸۵,۶۰۰,۰۰۰"
},
{
"carName": "GS3",
"marketPrice": "2,۷۲۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۹۹۲,۷۰۰,۰۰۰"
},
{
"carName": "CR-V",
"marketPrice": null,
"newCarPrice": "3,۵۸۰,۰۰۰,۰۰۰"
},
{
"carName": "ENS1",
"marketPrice": "2,۹۵۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۴۸۹,۰۰۰,۰۰۰"
},
{
"carName": "HR-V",
"marketPrice": "5,۹۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۶۹۷,۰۰۰,۰۰۰"
},
{
"carName": "ZR-V",
"marketPrice": null,
"newCarPrice": "2,۹۸۸,۰۰۰,۰۰۰"
},
{
"carName": "سیتی",
"marketPrice": "2,۶۸۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۲۷,۰۰۰,۰۰۰"
},
{
"carName": "وزل",
"marketPrice": "3,۲۷۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۴۷۵,۰۰۰,۰۰۰"
},
{
"carName": "NAT",
"marketPrice": null,
"newCarPrice": "1,۲۱۲,۰۷۶,۰۰۰"
},
{
"carName": "T77",
"marketPrice": "1,۸۵۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۱۵۲,۹۳۹,۰۰۰"
},
{
"carName": "EQM5",
"marketPrice": "1,۶۳۵,۰۰۰,۰۰۰",
"newCarPrice": "2,۱۳۷,۲۲۳,۰۰۰"
},
{
"carName": "H5",
"marketPrice": "3,۴۷۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۱۴۸,۵۰۰,۰۰۰"
},
{
"carName": "VS5",
"marketPrice": "2,۳۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۲۴۴,۰۰۰,۰۰۰"
},
{
"carName": "VS7",
"marketPrice": "2,۴۴۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۷۲۰,۰۰۰,۰۰۰"
},
{
"carName": "آزکارا",
"marketPrice": "2,۲۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۳۵۰,۰۰۰,۰۰۰"
},
{
"carName": "CS35 پلاس",
"marketPrice": "1,۸۸۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۴۱۱,۸۰۰,۰۰۰"
},
{
"carName": "CS55 پلاس",
"marketPrice": "2,۶۰۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۵۸,۱۲۲,۰۰۰"
},
{
"carName": "DL5",
"marketPrice": null,
"newCarPrice": "1,۱۴۴,۵۴۲,۰۰۰"
},
{
"carName": "ایما هیبرید ",
"marketPrice": "2,۵۸۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۹۹۸,۰۰۰,۰۰۰"
},
{
"carName": "D60 Plus",
"marketPrice": "1,۹۰۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۹۸۵,۷۰۰,۰۰۰"
},
{
"carName": "STAR",
"marketPrice": "2,۷۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۸۷,۹۰۰,۰۰۰"
},
{
"carName": "V-Online",
"marketPrice": "2,۱۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۲۴۵,۳۰۰,۰۰۰"
},
{
"carName": "V-Online-DDI",
"marketPrice": null,
"newCarPrice": "2,۳۰۰,۰۰۰,۰۰۰"
},
{
"carName": "۴",
"marketPrice": null,
"newCarPrice": "2,۴۹۰,۰۰۰,۰۰۰"
},
{
"carName": "۵",
"marketPrice": null,
"newCarPrice": "2,۲۹۰,۰۰۰,۰۰۰"
},
{
"carName": "GT",
"marketPrice": null,
"newCarPrice": "2,۵۹۰,۰۰۰,۰۰۰"
},
{
"carName": "سوپرب",
"marketPrice": "3,۵۸۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۹۹۹,۰۰۰,۰۰۰"
},
{
"carName": "H6 HEV",
"marketPrice": "2,۶۴۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۵۰۲,۴۷۵,۰۰۰"
},
{
"carName": "شاین مکس بنزینی",
"marketPrice": "1,۹۲۰,۰۰۰,۰۰۰",
"newCarPrice": "1,۷۹۱,۹۷۱,۰۰۰"
},
{
"carName": "شاین مکس هیبریدی",
"marketPrice": "1,۹۹۵,۰۰۰,۰۰۰",
"newCarPrice": "1,۸۲۴,۵۲۶,۰۰۰"
},
{
"carName": "کوراندو تک دیفرانسیل ",
"marketPrice": null,
"newCarPrice": "2,۶۵۰,۰۰۰,۰۰۰"
},
{
"carName": "کوراندو دو دیفرانسیل ",
"marketPrice": null,
"newCarPrice": "2,۷۸۰,۰۰۰,۰۰۰"
},
{
"carName": "سانگ پلاس",
"marketPrice": "3,۸۲۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۶۰۰,۰۰۰,۰۰۰"
},
{
"carName": "تانک ۳۰۰",
"marketPrice": "5,۳۴۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۵۲۵,۰۰۰,۰۰۰"
},
{
"carName": "بیجینگ X55 - تک رنگ",
"marketPrice": null,
"newCarPrice": "2,۰۵۰,۰۰۰,۰۰۰"
},
{
"carName": "بیجینگ X55 - دو رنگ",
"marketPrice": null,
"newCarPrice": "2,۰۶۵,۰۰۰,۰۰۰"
},
{
"carName": "اوتلندر - H - LINE",
"marketPrice": "6,۲۰۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۲۲۸,۰۰۰,۰۰۰"
},
{
"carName": "اوتلندر - L - LINE",
"marketPrice": "5,۰۴۰,۰۰۰,۰۰۰",
"newCarPrice": "بدون"
},
{
"carName": "اوتلندر - M - LINE",
"marketPrice": "5,۵۶۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۲۱۲,۰۰۰,۰۰۰"
},
{
"carName": "۳",
"marketPrice": "4,۶۰۰,۰۰۰,۰۰۰",
"newCarPrice": "2,۹۹۵,۸۰۰,۰۰۰"
},
{
"carName": "CX30",
"marketPrice": "5,۱۹۰,۰۰۰,۰۰۰",
"newCarPrice": "3,۲۶۷,۵۰۰,۰۰۰"
},
{
"carName": "ERX5",
"marketPrice": null,
"newCarPrice": "1,۷۸۷,۰۰۰,۰۰۰"
},
{
"carName": "آرکانا",
"marketPrice": null,
"newCarPrice": "3,۴۹۰,۰۰۰,۰۰۰"
},
{
"carName": "۱۱",
"marketPrice": null,
"newCarPrice": "4,۱۹۸,۰۰۰,۰۰۰"
},
{
"carName": "T03",
"marketPrice": null,
"newCarPrice": "1,۵۳۰,۰۰۰,۰۰۰"
}
]

File diff suppressed because it is too large Load Diff

1861
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

26
package.json Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "myproject",
"version": "1.0.0",
"description": "This project was bootstrapped with Fastify-CLI.",
"main": "app.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "node --test test/**/*.test.js",
"start": "fastify start -l info app.js",
"dev": "fastify start -w -l info -P app.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@fastify/autoload": "^5.0.0",
"@fastify/sensible": "^5.0.0",
"axios": "^1.9.0",
"fastify": "^4.26.1",
"fastify-cli": "^6.1.1",
"fastify-cron": "^1.4.0",
"fastify-plugin": "^4.0.0"
}
}

16
plugins/README.md Normal file
View File

@@ -0,0 +1,16 @@
# Plugins Folder
Plugins define behavior that is common to all the routes in your
application. Authentication, caching, templates, and all the other cross
cutting concerns should be handled by plugins placed in this folder.
Files in this folder are typically defined through the
[`fastify-plugin`](https://github.com/fastify/fastify-plugin) module,
making them non-encapsulated. They can define decorators and set hooks
that will then be used in the rest of your application.
Check out:
* [The hitchhiker's guide to plugins](https://fastify.dev/docs/latest/Guides/Plugins-Guide/)
* [Fastify decorators](https://fastify.dev/docs/latest/Reference/Decorators/).
* [Fastify lifecycle](https://fastify.dev/docs/latest/Reference/Lifecycle/).

96
plugins/corn.js Normal file
View File

@@ -0,0 +1,96 @@
'use strict'
const fp = require('fastify-plugin')
const fastifyCron = require('fastify-cron')
const cheerio = require('cheerio');
const { log } = require('console');
const fs = require('fs');
const axios = require('axios');
const akharin = 'https://akharinkhodro.ir/price/%D9%82%DB%8C%D9%85%D8%AA-%D8%AE%D9%88%D8%AF%D8%B1%D9%88/';
const hamrah = 'https://www.hamrah-mechanic.com/carprice/';
module.exports = fp(async function (fastify, opts) {
fastify.register(fastifyCron, {
jobs: [
{
cronTime: '0 0 0 * * *', ///'*/5 * * * * *'
onTick: async () => {
fastify.log.info('⏰ Cron Job ran at ' + new Date().toISOString())
try {
const { data } = await axios.get(akharin, {
headers: { 'User-Agent': 'Mozilla/5.0' },
});
const $ = cheerio.load(data);
const cars = [];
let td = $('tr')
let result = []
td.each((i, tr) => {
let listOfLine = $(tr).text().trim().split('\n')
if (listOfLine.length > 1) {
if (listOfLine[0] !== "نام خودرو") {
result.push({
carName: listOfLine[0],
marketPrice: listOfLine[1].trim().split(" ")[0] === "بدون" ? null : listOfLine[1].trim().split(" ")[0],
newCarPrice: listOfLine[2].trim().split(" ")[0]
})
}
}
})
fs.writeFileSync(`./json/akharin/${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDay()}-akharin-cars.json`, JSON.stringify(result, null, 2), 'utf-8');
console.log(`${new Date().getFullYear()}-$${new Date().getMonth()}-${new Date().getDay()}-akharin-cars.json => new:`, cars.length);
} catch (err) {
console.error('crawler stop:', err.message);
} },
start: true
},{
cronTime: '0 0 0 * * *', ///'*/5 * * * * *'
onTick: async () => {
fastify.log.info('⏰ Cron Job ran at hamrah ' + new Date().toISOString())
try {
const { data } = await axios.get(hamrah, {
headers: { 'User-Agent': 'Mozilla/5.0' },
});
const $ = cheerio.load(data);
const cars = [];
const result = []
let sectionName = $('div.carsBrandPriceList_brand__name__Ohntn')
let tables = $('tbody tr');
tables.each((i, tr) => {
const tds = $(tr).find('td');
const modelDivs = $(tds[0]).find('div');
const priceDivs = $(tds[1]).find('div');
const carName = $(modelDivs[0]).text().trim(); // مدل اصلی مثل Q5 E-tron
const typeAndYear = $(modelDivs[1]).text().replace(/\s+/g, ' ').trim(); // تیپ 40- فول-2024
const marketPrice = $(priceDivs[0]).text().trim(); // قیمت
result.push({carName , typeAndYear , marketPrice})
});
// ذخیره‌سازی در فایل JSON
fs.writeFileSync(`./json/hamrah/${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDay()}-hamrah-cars.json`, JSON.stringify(result, null, 2), 'utf-8');
console.log(`${new Date().getFullYear()}-$${new Date().getMonth()}-${new Date().getDay()}-akharin-cars.json => new:`, cars.length);
} catch (err) {
console.error('❌ خطا در کراول:', err.message);
} },
start: true
}
]
})
})

14
plugins/sensible.js Normal file
View File

@@ -0,0 +1,14 @@
'use strict'
const fp = require('fastify-plugin')
/**
* This plugins adds some utilities to handle http errors
*
* @see https://github.com/fastify/fastify-sensible
*/
module.exports = fp(async function (fastify, opts) {
fastify.register(require('@fastify/sensible'), {
errorHandler: false
})
})

12
plugins/support.js Normal file
View File

@@ -0,0 +1,12 @@
'use strict'
const fp = require('fastify-plugin')
// the use of fastify-plugin is required to be able
// to export the decorators to the outer scope
module.exports = fp(async function (fastify, opts) {
fastify.decorate('someSupport', function () {
return 'hugs'
})
})

27
routes/README.md Normal file
View File

@@ -0,0 +1,27 @@
# Routes Folder
Routes define routes within your application. Fastify provides an
easy path to a microservice architecture, in the future you might want
to independently deploy some of those.
In this folder you should define all the routes that define the endpoints
of your web application.
Each service is a [Fastify
plugin](https://fastify.dev/docs/latest/Reference/Plugins/), it is
encapsulated (it can have its own independent plugins) and it is
typically stored in a file; be careful to group your routes logically,
e.g. all `/users` routes in a `users.js` file. We have added
a `root.js` file for you with a '/' root added.
If a single file become too large, create a folder and add a `index.js` file there:
this file must be a Fastify plugin, and it will be loaded automatically
by the application. You can now add as many files as you want inside that folder.
In this way you can create complex routes within a single monolith,
and eventually extract them.
If you need to share functionality between routes, place that
functionality into the `plugins` folder, and share it via
[decorators](https://fastify.dev/docs/latest/Reference/Decorators/).
If you're a bit confused about using `async/await` to write routes, you would
better take a look at [Promise resolution](https://fastify.dev/docs/latest/Reference/Routes/#promise-resolution) for more details.

7
routes/example/index.js Normal file
View File

@@ -0,0 +1,7 @@
'use strict'
module.exports = async function (fastify, opts) {
fastify.get('/', async function (request, reply) {
return 'this is an example'
})
}

15
routes/root.js Normal file
View File

@@ -0,0 +1,15 @@
'use strict'
const { log } = require("console")
const {readFile , readdir} = require('fs/promises')
module.exports = async function (fastify, opts) {
fastify.get('/price', async function (request, reply) {
if(Object.keys(request.query).length == 0) return reply.status(500).send({ ok: false, message:'use query params' , enums:['akharin' , 'hamrah'] })
let dir = await readdir(`${process.cwd()}/json/${Object.keys(request.query)[0]}`)
let file = await readFile(`${process.cwd()}/json/${Object.keys(request.query)[0]}/${dir[0]}` , 'utf-8')
return JSON.parse(file)
})
}

35
test/helper.js Normal file
View File

@@ -0,0 +1,35 @@
'use strict'
// This file contains code that we reuse
// between our tests.
const { build: buildApplication } = require('fastify-cli/helper')
const path = require('node:path')
const AppPath = path.join(__dirname, '..', 'app.js')
// Fill in this config with all the configurations
// needed for testing the application
function config () {
return {}
}
// automatically build and tear down our instance
async function build (t) {
// you can set all the options supported by the fastify CLI command
const argv = [AppPath]
// fastify-plugin ensures that all decorators
// are exposed for testing purposes, this is
// different from the production setup
const app = await buildApplication(argv, config())
// close the app after we are done
t.after(() => app.close())
return app
}
module.exports = {
config,
build
}

View File

@@ -0,0 +1,28 @@
'use strict'
const { test } = require('node:test')
const assert = require('node:assert')
const Fastify = require('fastify')
const Support = require('../../plugins/support')
test('support works standalone', async (t) => {
const fastify = Fastify()
fastify.register(Support)
await fastify.ready()
assert.equal(fastify.someSupport(), 'hugs')
})
// You can also use plugin with opts in fastify v2
//
// test('support works standalone', (t) => {
// t.plan(2)
// const fastify = Fastify()
// fastify.register(Support)
//
// fastify.ready((err) => {
// t.error(err)
// assert.equal(fastify.someSupport(), 'hugs')
// })
// })

View File

@@ -0,0 +1,28 @@
'use strict'
const { test } = require('node:test')
const assert = require('node:assert')
const { build } = require('../helper')
test('example is loaded', async (t) => {
const app = await build(t)
const res = await app.inject({
url: '/example'
})
assert.equal(res.payload, 'this is an example')
})
// inject callback style:
//
// test('example is loaded', (t) => {
// t.plan(2)
// const app = await build(t)
//
// app.inject({
// url: '/example'
// }, (err, res) => {
// t.error(err)
// assert.equal(res.payload, 'this is an example')
// })
// })

28
test/routes/root.test.js Normal file
View File

@@ -0,0 +1,28 @@
'use strict'
const { test } = require('node:test')
const assert = require('node:assert')
const { build } = require('../helper')
test('default root route', async (t) => {
const app = await build(t)
const res = await app.inject({
url: '/'
})
assert.deepStrictEqual(JSON.parse(res.payload), { root: true })
})
// inject callback style:
//
// test('default root route', (t) => {
// t.plan(2)
// const app = await build(t)
//
// app.inject({
// url: '/'
// }, (err, res) => {
// t.error(err)
// assert.deepStrictEqual(JSON.parse(res.payload), { root: true })
// })
// })