Exercises for personal study of Nodejs, frameworks and related topics
- Install Nodejs v7.9.x or higher
- Install Npm or Yarn
- π² hapi-basic-example: Hapi.js
- π΄ hapi-rest-services: Hapi.js Basic Restful Services
- π hapi-rest-services-jwt: Hapi.js Basic Restful Services and JWT authentication
- π hapi-rest-services-jwt-bcrypt: Hapi.js Basic Restful Services, JWT authentication and Bcrypt
- π hapi-rest-services-jwt-bcrypt-Middle: Hapi.js Basic Restf., JWT, Bcrypt, Middle., and Authorization (roles).
- π hapi-rest-class-es6: Hapi, Restful, JWT, Bcrypt, Middle. Autho., ES6 Classes. π
- π hapi-rest-mysql (See function testConnectTableUser): Hapi, Restful, JWT, Bcrypt, Middle. Autho., ES6 Classes, Mysql. π
-
npm install
oryarn install
-
npm start
oryarn start
-
Install mysql version 5.6.x and create a database called hapimysql.
-
Change connection data to mysql in /hapi-rest-mysql/api/config.js with your connection data.
-
After, run the following sql into hapimysql database:
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`names` varchar(100) NOT NULL,
`surnames` varchar(100) NOT NULL,
`number_identification` varchar(25) NOT NULL,
`role` varchar(30) NOT NULL,
`email` varchar(150) NOT NULL,
`password` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
- npm run start :
node app.js
- npm run test :
NODE_ENV='test' ./node_modules/lab/bin/lab -c
- npm run startpro :
NODE_ENV=pro node app.js
- npm run readme :
node ./node_modules/.bin/node-readme
Package | Version | Dev |
---|---|---|
bcrypt | ^1.0.2 | β |
code | ^4.0.0 | β |
hapi | ^16.1.0 | β |
hapi-auth-jwt2 | ^7.2.4 | β |
hapi-authorization | ^3.0.2 | β |
jsonwebtoken | ^7.3.0 | β |
lab | ^12.1.0 | β |
node-readme | ^0.1.9 | β |
Contributions welcome; Please submit all pull requests the against master branch. If your pull request contains JavaScript patches or features, you should include relevant unit tests. Thanks!
Stivenson Rincon