touch .eslintrc prettier.config.js .editorconfig .babelrcnpm install -D @upstatement/eslint-config @upstatement/prettier-config eslint babel-eslint prettier eslint-config-prettier husky pretty-quick lint-staged| <div class='container'> | |
| <h1>SASS - Variables</h1> | |
| <h2><span>Basic</span> - Getting Started</h2> | |
| <p id='mypara'>Lorem ipsum dolor sit amet, consectetur | |
| adipiscing elit, sed do eiusmod tempor <br> | |
| incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis | |
| nostrud exercitation ullamco laboris nisi</p> |
| { | |
| "name": "boilerplate", | |
| "version": "0.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "start" : "browser-sync start --server --files '*.css, *.html, *.js'" | |
| }, | |
| "author": "", | |
| "license": "ISC", |
| html { | |
| box-sizing: border-box; | |
| } | |
| *, | |
| *:before, | |
| *:after { | |
| box-sizing: inherit; | |
| } |
https://help.github.com/en/articles/managing-commit-signature-verification
Check for existing GPG keys
gpg --list-secret-keys --keyid-format LONG| // routes/index.js | |
| const express = require('express'); | |
| const router = express.Router(); | |
| // App routes (for the mobile app) | |
| const APP = express.Router(); | |
| router.use('/', APP); | |
| APP.get('/users/:id', isAuthenticated, userController.getUser); |
| ADMIN.delete( | |
| '/users/:id', // route path | |
| isAuthenticated, // authentication middleware | |
| isAdmin, // authorization middleware | |
| adminUserController.deleteUser // controller | |
| ); |
| /** | |
| * Check if a user has access to the app admin | |
| */ | |
| const isAdmin = async (req, res, next) => { | |
| if (req.headers && req.headers.authorization) { | |
| if (!req.user || !req.user.isAdmin) { | |
| return res.status(403).json({ message: 'You must have admin permissions.' }); | |
| } | |
| // If we get here, we're good so pass it along | |
| next(); |
| /** | |
| * Delete a user with the given ID | |
| */ | |
| const deleteUser = async (req, res, next) => { | |
| const { id } = req.params; | |
| try { | |
| await User.deleteUserById(id); | |
| res.status(202).json({ message: `User ${id} deleted!` }); | |
| } catch (e) { | |
| const err = new Error('Could not delete user'); |
| // models/Base.js | |
| class Base { | |
| constructor(args) { | |
| const results = this.validatedData(args); | |
| Object.assign(this, results); | |
| } | |
| get schema() { | |
| throw ('You must declare a schema'); |