brianschardt / node_rest_api_mysql Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
can you please remove the unneeded files and folders like migrations and api documentation?
when running: npm install:
rmktest@nodejs-tests-vm-vm:~/projects/node_rest_api_mysql$ npm install
[email protected] install /home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
make: Entering directory '/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/build'
make: Entering directory '/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
rm: cannot remove './Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw': No such file or directory
bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
make: Leaving directory '/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/bitnami/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.9.0-8-amd64
gyp ERR! command "/opt/bitnami/nodejs/bin/.node.bin" "/opt/bitnami/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/opt/bitnami/nodejs/bin/.node.bin /opt/bitnami/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/lib/binding' (1)
node-pre-gyp ERR! stack at ChildProcess. (/home/rmktest/projects/node_rest_api_mysql/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Linux 4.9.0-8-amd64
node-pre-gyp ERR! command "/opt/bitnami/nodejs/bin/.node.bin" "/home/rmktest/projects/node_rest_api_mysql/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt
node-pre-gyp ERR! node -v v10.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute '/opt/bitnami/nodejs/bin/.node.bin /opt/bitnami/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/lib/binding' (1)
../src/bcrypt.cc:322:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/bcrypt_lib/src/bcrypt.o.d.raw: No such file or directory
}
^
compilation terminated.
bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/bcrypt.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt.o] Error 1
make: Leaving directory '/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/bitnami/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.9.0-8-amd64
gyp ERR! command "/opt/bitnami/nodejs/bin/.node.bin" "/opt/bitnami/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /home/rmktest/projects/node_rest_api_mysql/node_modules/bcrypt
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/rmktest/.npm/_logs/2018-10-30T07_44_00_873Z-debug.log
rmktest@nodejs-tests-vm-vm:~/projects/node_rest_api_mysql$
Executing (default): INSERT INTO `Users` (`id`,`first`,`last`,`email`,`phone`,`password`,`createdAt`,`updatedAt`) VALUES (DEFAULT,'fn','sn','[email protected]','1234567891','$2a$10$79CyNDx0W8Bwyn6IG.ZleeMNXBo/s4Y.FIvoQCPxu0dY6IEfYipMy','2018-02-25 08:44:25','2018-02-25 08:44:25');
/home/solooo7/Documents/MASTER/TEST/node_rest_api_mysql/node_modules/sequelize/lib/dialects/mysql/query.js:186
const uniqueKey = this.model && this.model.uniqueKeys[match[2]];
^
TypeError: Cannot read property '2' of null
at Query.formatError (/home/solooo7/Documents/MASTER/TEST/node_rest_api_mysql/node_modules/sequelize/lib/dialects/mysql/query.js:186:68)
at Query.connection.query [as onResult] (/home/solooo7/Documents/MASTER/TEST/node_rest_api_mysql/node_modules/sequelize/lib/dialects/mysql/query.js:55:23)
at Query.Command.execute (/home/solooo7/Documents/MASTER/TEST/node_rest_api_mysql/node_modules/mysql2/lib/commands/command.js:30:12)
at Connection.handlePacket (/home/solooo7/Documents/MASTER/TEST/node_rest_api_mysql/node_modules/mysql2/lib/connection.js:515:28)
at PacketParser.onPacket (/home/solooo7/Documents/MASTER/TEST/node_rest_api_mysql/node_modules/mysql2/lib/connection.js:94:16)
at PacketParser.executeStart (/home/solooo7/Documents/MASTER/TEST/node_rest_api_mysql/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket.<anonymous> (/home/solooo7/Documents/MASTER/TEST/node_rest_api_mysql/node_modules/mysql2/lib/connection.js:102:29)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./bin/www`
npm
ERR! Exit status 1
It doesn't catch errors when I register with same user details.
Any idea why?
Hi,
is there any way to make commands like "node_modules/.bin/sequelize db:create" use the values from .env or config.js?
would you please show us how to connect as 443 https ?
I tried many ways to expire token when logout but didn't work how to resolve
app.get('/logout', function(req, res){
req.logout();
});
When I type "npm start", it shows following error.
> [email protected] start /Volumes/Data/Study/node_rest_api_mysql
> node ./bin/www
Environment: dev
Server listenning on port: 3000
Unable to connect to SQL database: test { SequelizeConnectionError: Host '127.0.0.1' is not allowed to connect to this MySQL server
at Utils.Promise.tap.then.catch.err (/Volumes/Data/node_rest_api_mysql/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:149:19)
at tryCatcher
..
Hi Brian,
I encountered an error as stated in the subject line.
In my local copy, I added the following entries in the config.js (after the global declarations)
module.exports = {
development: {
username: 'whatsmyname',
password: 'whatsmypassword',
database: 'whatsmydb',
host: '127.0.0.1',
dialect: 'mysql'
},
test: {
username: 'whatsmyname',
password: 'whatsmypassword',
database: 'whatsmydb',
host: '127.0.0.1',
dialect: 'mysql'
},
production: {
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOST,
dialect: 'mysql'
}
};
Kindly confirm if this is a good approach or if you have any other suggestions. But, for now, this addition helped me run the migration flawlessly.
BTW, I like the architecture ;)
Thanks
Hi, I like your project, would you please add a license to it?
Greetings, I really like your application, in fact I have learned a lot with the details of your explanation, but there is a function that I can not find, or I do not know where it comes from. and for future consultations of other tables know how to implement them.
[err, companies] = await to(user.getCompanies({include: [ {association: Company.Users} ] }));
where “user.getCompanies” came from
Excuse my english, I’m supporting myself in google. Thank you.
Dialect needs to be explicitly supplied as of v4.0.0
'use strict';
module.exports = (sequelize, DataTypes) => {
var Model = sequelize.define('Company', {
name: DataTypes.STRING
});
Model.associate = function(models){
this.Users = this.belongsToMany(models.User, {through: 'UserCompany'});
};
return Model;
};
Can you please explain why this
is used in this.Users = this.belongsToMany(models.User, {through: 'UserCompany'});
How do I write belongsTo relation?
I'm a beginner
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.