Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
161 changes: 0 additions & 161 deletions README.md

This file was deleted.

22 changes: 21 additions & 1 deletion app/config/db.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
/*module.exports = {
HOST: "localhost",
USER: "postgres",
PASSWORD: "123",
Expand All @@ -11,3 +11,23 @@ module.exports = {
idle: 10000
}
};
*/

module.exports = {
HOST: "dpg-co7bpEn109ks73860js0-a.oregon-postgres.render.com",
USER: "postgres_user",
PASSWORD: "J4lg1IhBM7viuX8EH6PnUKx8Q9U8xECm",
DB: "testdb_vnej",
dialect: "postgres",
dialectOptions: {
"ssl": true ,
keepAlive: true
},
ssl: true,
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
};
30 changes: 21 additions & 9 deletions app/models/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
const dbConfig = require("../config/db.config.js");

const Sequelize = require("sequelize");
const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, dbConfig.PASSWORD, {
host: dbConfig.HOST,
dialect: dbConfig.dialect,

pool: {
max: dbConfig.pool.max,
min: dbConfig.pool.min,
acquire: dbConfig.pool.acquire,
idle: dbConfig.pool.idle
// const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, dbConfig.PASSWORD, {
// host: dbConfig.HOST,
// dialect: dbConfig.dialect,

// pool: {
// max: dbConfig.pool.max,
// min: dbConfig.pool.min,
// acquire: dbConfig.pool.acquire,
// idle: dbConfig.pool.idle
// }
// });


// Connection string
const connectionString = 'postgres://postgres_user:J4lg1IhAM7viuX8EH6PnUKx8Q9U8xECm@dpg-co7bp0n109ks73860js0-a.oregon-postgres.render.com/testdb_vnej';

// Initialize Sequelize with the connection string
const sequelize = new Sequelize(connectionString, {
dialect: 'postgres', // Specify the dialect
dialectOptions: {
ssl: true // Enable SSL
}
});

Expand Down
6 changes: 5 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ app.use(express.json()); /* bodyParser.json() is deprecated */
// parse requests of content-type - application/x-www-form-urlencoded
app.use(express.urlencoded({ extended: true })); /* bodyParser.urlencoded() is deprecated */

app.get("/createdBy",(req,res)=>{
res.send("Name of the Student : Patel jaykumar vijaybhai \n Enrollment No : SR22MSIT015 \n Technology : NodeJs \n Organization : Maruti Techno Lab")
});

const db = require("./app/models");
db.sequelize.sync();
// // drop the table if it already exists
Expand All @@ -25,7 +29,7 @@ db.sequelize.sync();

// simple route
app.get("/", (req, res) => {
res.json({ message: "Welcome to bezkoder application." });
res.json({ message: "Welcome to my application." });
});

require("./app/routes/turorial.routes")(app);
Expand Down