This project uses JavaScript Standard Style, enforced (so far only in the front end) by ESLint.
Use of ES6+ features in this project is encouraged.
- MongoDB
- NodeJS
- PM2 (for production deployment)
Clone the repository
git clone https://github.com/alexanderpepper/vuetify-loopback-mongodb.git;Install NPM packages
cd vuetify-loopback-mongodb
npm install
cd client
npm install- Create
/server/constants/credentials.jswith the following content:
const isProd = process.env.NODE_ENV === 'production'
module.exports = {
clientSecret: '<your_client_secret>',
clientId: '<your_client_id>',
redirectUri: isProd ? 'https://yoursite.com/callback' : 'http://localhost:8080/callback'
}Running the server and client as separate processes gives the best development experience with hot reloading in the client app.
The client app is
- Configured in
client/.env.developmentto usehttp://localhost:3000/apias the base API path when running in development - Configured in
client//.env.productionto use/apias the base API path when built for production
To run the Loopback server in devepment mode on https://localhost:3000:
node .Loopback uses swagger to document the server's REST API. This can be viewed at http://localhost:3000/explorer
To run the Vue client in development mode on http://localhost:8080
cd client
npm run devAcquire a standalone certificate from LetsEncrypt and create server/ssl-config.js with the following content:
const path = require('path')
const fs = require('fs')
const isProd = process.env.NODE_ENV === 'production'
exports.privateKey = isProd ? fs.readFileSync(path.join('/path/to/privkey.pem')).toString() : ''
exports.certificate = isProd ? fs.readFileSync(path.join('/path/to/cert.pem')).toString() : ''
exports.chain = isProd ? fs.readFileSync(path.join('/path/to/chain.pem')).toString() : ''
exports.fullchain = isProd ? fs.readFileSync(path.join('/path/to/fullchain.pem')).toString() : ''When the server starts, /server/boot/client.js builds the client app by running npm run build in the client folder.
To start the server
node_modules/pm2/bin/pm2 start pm2.json --env productionTo stop the server
node_modules/pm2/bin/pm2 killTo monitor the server
node_modules/pm2/bin/pm2 monitMIT © 2018 Alex Pepper