Skip to content

Conversation

@amanapp
Copy link
Owner

@amanapp amanapp commented Aug 8, 2023

No description provided.

@@ -0,0 +1,15 @@
import mongoose from 'mongoose';
const url = "mongodb://localhost:27017/cron-testing";
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

place this in .env file


}catch(e){
console.log(e,"ERRRRRR");
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use proper indentation.

const userSchema: Schema<User> = new Schema<User>({
name: { type: String, required: true },
email: { type: String, required: true },
user_id: { type: String, required: true },
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this as username

password: { type: String, required: true },
phone_no: { type: String, required: true },
created_At: { type: Date, default: Date.now },
updated_At: { type: Date, default: Date.now },
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make use of timestamps:true

import fs from 'fs';
import cron from 'node-cron';

const app=express();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make use of classes



const task=cron.schedule('*/3 * * * * *', () => {
const filePath = '/home/user/Videos/error_log/error.log';
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make use of global path, check if cwd works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants