Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import mongoose from "mongoose";

const connectDB = async () => {
if (mongoose.connections[0].readyState) {
return true;
}

try {
await mongoose.connect(process.env.MONGODB_URI);
console.log("Mongodb connected");
return true;
} catch (error) {
console.log(error);
}
};

export default connectDB;

39 changes: 0 additions & 39 deletions lib/mongodb.js

This file was deleted.

15 changes: 15 additions & 0 deletions models/postModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Schema, model, models } from "mongoose";

const postSchema = new Schema(
{
msg: {
type: String,
required: true,
},
},
{ timestamps: true }
);

const PostModel = models.post || model("post", postSchema);

export default PostModel;
40 changes: 0 additions & 40 deletions models/student.js

This file was deleted.

9 changes: 6 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
// const nextConfig = {}

// module.exports = nextConfig


/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
};

// module.exports = {
// target: "server",
// };
module.exports = {
target: "server",
output: "export",
};

module.exports = { nextConfig };
Loading