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

halhlall

parent 9a130531
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"main": "index.js", "main": "index.js",
"type": "module", "type": "module",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "dev": "node src/index.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"express": "^4.18.2" "express": "^4.18.2",
"mongoose": "^6.8.3"
} }
} }
...@@ -10,4 +10,6 @@ app.get("/", (req, res) => { ...@@ -10,4 +10,6 @@ app.get("/", (req, res) => {
app.listen(port, () => { app.listen(port, () => {
console.log(`server is runnug at ${port} port.`) console.log(`server is runnug at ${port} port.`)
}) })
\ No newline at end of file
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 port = 3000;
const app = express();
app.get("/", (req, res) => { mongoose
console.log("root path get method called.") .connect("mongodb://127.0.0.1:27017/test")
res.send("!23") .then((mgs) => {
console.log(`버전 ${mgs.version} 몽구스 : 몽고디비가 접속되었습니다.`);
app.listen(port, () =>{
console.log(`server is running at ${port} port. `);
})
}) })
.catch((error) => {
app.listen(port, () => { console.log(error);
console.log(`server is runnug at ${port} port.`)
}) })
\ 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