generated from HugoRCD/nuxt3-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from HugoRCD/feat/44
- Loading branch information
Showing
4 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
//https://nitro.unjs.io/config | ||
export default defineNitroConfig({ | ||
srcDir: 'server', | ||
|
||
experimental: { | ||
tasks: true | ||
} | ||
}, | ||
|
||
scheduledTasks: { | ||
'* * * * *': ['sync:mongo'] | ||
}, | ||
|
||
compatibilityDate: '2024-12-29' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { MongoDBClient } from '@currencia/mongo' | ||
|
||
export default defineTask({ | ||
meta: { | ||
name: 'sync:mongo', | ||
description: 'Send MongoID to RabbitMQ', | ||
}, | ||
async run() { | ||
const client = await MongoDBClient.create() | ||
console.log('Syncing MongoID to RabbitMQ') | ||
const price = await client.getLatestPrices() | ||
console.log('Price:', price) | ||
console.log('Ids to sync:', price?._id) | ||
return { result: 'Success' } | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters