Commit 16b2e59a authored by Park Sungwoo's avatar Park Sungwoo
Browse files

halhlall

parent 9a130531
This diff is collapsed.
......@@ -5,7 +5,7 @@
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"dev": "node src/index.js"
},
"repository": {
"type": "git",
......@@ -15,6 +15,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.2"
"express": "^4.18.2",
"mongoose": "^6.8.3"
}
}
......@@ -11,3 +11,5 @@ app.get("/", (req, res) => {
app.listen(port, () => {
console.log(`server is runnug at ${port} port.`)
})
export default app
\ No newline at end of file
import express from "express";
import mongoose from "mongoose";
import app from "./app.js";
const port = 3000;
const app = express();
app.get("/", (req, res) => {
console.log("root path get method called.")
res.send("!23")
mongoose
.connect("mongodb://127.0.0.1:27017/test")
.then((mgs) => {
console.log(`버전 ${mgs.version} 몽구스 : 몽고디비가 접속되었습니다.`);
app.listen(port, () =>{
console.log(`server is running at ${port} port. `);
})
})
app.listen(port, () => {
console.log(`server is runnug at ${port} port.`)
.catch((error) => {
console.log(error);
})
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment