Skip to content

Commit

Permalink
fazendo as conexões do projeto api e as funções.
Browse files Browse the repository at this point in the history
  • Loading branch information
DuxAlex committed Aug 23, 2023
1 parent 19fbc1e commit b32e5cc
Show file tree
Hide file tree
Showing 27 changed files with 447 additions and 7 deletions.
Empty file removed app.js
Empty file.
13 changes: 12 additions & 1 deletion node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/mime.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/mime.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion node_modules/.bin/nodemon

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/nodemon.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/nodemon.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion node_modules/.bin/nodetouch

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/nodetouch.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/nodetouch.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion node_modules/.bin/nopt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/nopt.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/nopt.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/semver.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/semver.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"mongodb": "^5.6.0",
"mongoose": "^5.13.8",
"nodemon": "^3.0.1"
}
},
"devDependencies": {}
}
12 changes: 12 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import app from "./src/app.js";
import chalk from "chalk";

const port = 2727;

app.listen(port, () => {
console.log(
chalk.green.bgGray.bold(`Servidor está rodando na porta, ${port}`)
);
});

export default app;
20 changes: 20 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import express, { json } from "express";
import index from "./routes/index.js";
import db from "./config/dbconnect.js";
import projetos from "./routes/projeto.js";
import chalk from "chalk";

const app = express();

app.use (json());
app.use ("/", index);
app.use ("/projetos", projetos);

db.on("error", console.log.bind(console, "erro de conexão"));
db.once ("open", () =>{
consle.log(
chalk.green.bgRgb(180, 180, 180).bold("conexão com o banco feita com sucesso")
);
});

export default app;
9 changes: 9 additions & 0 deletions src/config/dbconnect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import mongoose from "mongoose"

mongoose.connect(
"mongodb+srv:https://admin:[email protected]/git"
);

let db = mongoose.connection;

export default db;
Loading

0 comments on commit b32e5cc

Please sign in to comment.