Set up project:
mkdir project
cd project
npm init -y
module.exports = { | |
AF: { | |
name: 'Afghanistan', | |
divisions: { | |
'AF-BDS': 'Badakhshān', | |
'AF-BDG': 'Bādghīs', | |
'AF-BGL': 'Baghlān', | |
'AF-BAL': 'Balkh', | |
'AF-BAM': 'Bāmīān', | |
'AF-FRA': 'Farāh', |
const Hapi = require('@hapi/hapi'); | |
const MongoClient = require('mongodb').MongoClient; | |
const Boom = require('@hapi/boom'); | |
const totalAmountReducer = (userItems) => (prev, item) => { | |
const itemsPrice = item.price * userItems.find(v => v.itemId === item.itemId).quantity | |
return prev + itemsPrice; | |
}; | |
const server = Hapi.server({ |
docker exec -it container-name redis-cli -a pass FLUSHALL |
# in the folder | |
# Create the config file | |
module.exports{ | |
port: process.env.PORT || 3000, | |
db: process.env.MONGO_URI | |
} | |
# Create package.json | |
npm init -y |
# in the nuxt app directory | |
heroku create | |
# Set ENV_VARS | |
heroku config:set NPM_CONFIG_PRODUCTION=false HOST=0.0.0.0 NODE_ENV=production | |
# CREATE Procfile | |
echo 'web: npm run start' > Procfile | |
# ADD JSON script |
# time saving when you want to get rid babel.js | |
regex: import (\w+) from "((\w|\-)+)"; # this will match import export | |
const $1 = require("$2"); # this will replace them with require |