基于Node.js,MySQL和JWT的Rest API应用
本文介绍基于Node.js和MySQL搭建一个简单的Rest API应用,认证基于JWT(JSON Web Token)。其他用到的技术包括:路由:Express,ORM/数据库:Sequelize, 认证:Passport。 源码的Github地址:https://github.com/brianalois/node_rest_api_mysqlApp结构这里结合了标准的express
本文介绍基于Node.js和MySQL搭建一个简单的Rest API应用,认证基于JWT(JSON Web Token)。其他用到的技术包括:路由:Express,ORM/数据库:Sequelize, 认证:Passport。 源码的Github地址:https://github.com/brianalois/node_rest_api_mysqlApp结构这里结合了标准的express
以下为MySQL备份数据库的sh脚本:#!/bin/bash# Shell script to backup MySQL database# 设置数据库连接变量MyUSER="" # DB_USERNAMEMyPASS="" # DB_PASSWORDMyHOST="" # DB_HOSTNAME# 备份数据的目标目录DEST="" # /home/username/backups/DB# 邮件通
Webpack打包时,Node.js报错:const utils = require('./utils');^^^^^SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10)
使用npm安装软件包时报错:npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512软件版本npm: 5.0.3node: v
在Linux使用npm安装mongodb报了ENOSPC的错误,错误信息:# npm install mongodb npm http GET https://registry.npmjs.org/mongodb npm http 200 https://registry.npmjs.org/mongodb
查看npm全局仓库路径npm的全局仓库路径前缀配置在prefix,查看prefix配置即可。查看prefix$ npm config get prefix /home/cc/.nvm/versions/node/v8.7.0 Linux的全局仓库在{prefix}/lib/node_modules Windows的全局仓库在{prefix}/node_mod
Node.js目前有三种方法写一个文件:1、fs.write(fd, buffer, offset, length, position, callback)这个方法是没有缓存的,需要等待回调才能确保将buffer写入磁盘。 2、fs.writeFile(filename, data, [encoding],
Git是不允许添加空目录到仓库的。一般做法是在空目录里添加一个文件。通常会添加的文件如下:1、添加.gitignore,内容如下:# Ignore everything in this directory * # Except this file !.gitignore 这目的不让git忽略此文件2、添加.gitkee
从Bower1.8.2开始,原来的registry url http://bower.herokuapp.com 被废弃,新的registry ur迁移到https://registry.bower.io。对于Bower1.8.2之前的版本,如果没有修改registry url,使用bower时会报401错误,如下:EINVRES Req
升级命令很简单npm install npm@latest -g 如果安装失败,可以把node_modules里的包清空后安装