Skip to content

Commit

Permalink
WAR-314 Include docker build scripts in nodejs seeds.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimeloper committed Nov 17, 2023
1 parent e35671a commit 0fb9df2
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ Thumbs.db
# Node.js
node_modules/

# Dist directory
# Dist directories
/dist
dist/

# Environment configuration
.env
Expand Down
10 changes: 8 additions & 2 deletions backend/node-js-express/node-js-express-mongoose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@
"scripts": {
"start": "node server.js",
"lint": "eslint ./app",
"lint:fix": "eslint --fix ./app"
"lint:fix": "eslint --fix ./app",
"prebuild": "rimraf dist",
"build": "webpack",
"start:prod": "node ./dist/main"
},
"dependencies": {
"dotenv": "^16.3.1",
"express": "^4.18.2",
"mongodb": "^6.3.0",
"mongoose": "^7.5.4"
},
"devDependencies": {
"eslint": "^8.52.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.2.0",
"eslint-plugin-promise": "^6.1.1"
"eslint-plugin-promise": "^6.1.1",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
}
}
23 changes: 23 additions & 0 deletions backend/node-js-express/node-js-express-mongoose/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const path = require('path');

module.exports = {
mode: 'production',
entry: './server.js',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/',
filename: 'main.js',
},
module: {
rules: [{
test: /\.js?$/,
exclude: /node_modules/
}]
},
resolveLoader: {
modules: [
__dirname + '/node_modules'
]
},
target: 'node',
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
const pg = require('pg');
const { Sequelize } = require('sequelize');

const sequelize = new Sequelize(process.env.POSTGRES_DATABASE, process.env.POSTGRES_USER, process.env.POSTGRES_PASSWORD, {
host: process.env.POSTGRES_HOST,
dialect: 'postgres',
port: process.env.POSTGRES_PORT || 5432,
dialectOptions: {
// Remove or comment out the ssl property if it's not supported by your PostgreSQL server
// ssl: {
// require: process.env.POSTGRES_SSL === 'true', // Whether to require SSL
// rejectUnauthorized: process.env.POSTGRES_SSL === 'true' // Whether to reject self-signed certificates
// // Note: rejectUnauthorized should be set to true in production for security reasons
// }
}
host: process.env.POSTGRES_HOST,
dialect: 'postgres',
dialectModule: pg,
port: process.env.POSTGRES_PORT || 5432,
dialectOptions: {
// Remove or comment out the ssl property if it's not supported by your PostgreSQL server
// ssl: {
// require: process.env.POSTGRES_SSL === 'true', // Whether to require SSL
// rejectUnauthorized: process.env.POSTGRES_SSL === 'true' // Whether to reject self-signed certificates
// // Note: rejectUnauthorized should be set to true in production for security reasons
// }
}
});

module.exports = sequelize;
12 changes: 10 additions & 2 deletions backend/node-js-express/node-js-express-postgresql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,31 @@
"version": "1.0.0",
"description": "A foundational seed for Node-Express and Javascript with PostgreSQL projects.",
"main": "server.js",
"license": "MIT",
"scripts": {
"start": "node server.js",
"lint": "eslint ./app",
"lint:fix": "eslint --fix ./app"
"lint:fix": "eslint --fix ./app",
"prebuild": "rimraf dist",
"build": "webpack",
"start:prod": "node ./dist/main"
},
"dependencies": {
"dotenv": "^16.3.1",
"express": "^4.18.2",
"pg": "^8.11.3",
"pg-hstore": "^2.3.4",
"request": "^2.88.2",
"rimraf": "^5.0.5",
"sequelize": "^6.33.0"
},
"devDependencies": {
"eslint": "^8.52.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.2.0",
"eslint-plugin-promise": "^6.1.1"
"eslint-plugin-promise": "^6.1.1",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const path = require('path');

module.exports = {
mode: 'production',
entry: './server.js',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/',
filename: 'main.js',
},
module: {
rules: [{
test: /\.js?$/,
exclude: /node_modules/
}]
},
resolveLoader: {
modules: [
__dirname + '/node_modules'
]
},
target: 'node',
};
9 changes: 7 additions & 2 deletions backend/node-js-express/node-js-express-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"scripts": {
"start": "node server.js",
"lint": "eslint ./app",
"lint:fix": "eslint --fix ./app"
"lint:fix": "eslint --fix ./app",
"prebuild": "rimraf dist",
"build": "webpack",
"start:prod": "node ./dist/main"
},
"dependencies": {
"express": "^4.18.2"
Expand All @@ -16,6 +19,8 @@
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.2.0",
"eslint-plugin-promise": "^6.1.1"
"eslint-plugin-promise": "^6.1.1",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
}
}
23 changes: 23 additions & 0 deletions backend/node-js-express/node-js-express-starter/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const path = require('path');

module.exports = {
mode: 'production',
entry: './server.js',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/',
filename: 'main.js',
},
module: {
rules: [{
test: /\.js?$/,
exclude: /node_modules/
}]
},
resolveLoader: {
modules: [
__dirname + '/node_modules'
]
},
target: 'node',
};

0 comments on commit 0fb9df2

Please sign in to comment.