Code Monkey home page Code Monkey logo

workshop-js's Introduction

Workshop JS โš™๏ธ Workshop with JavaScript

This experimental workshop repo is designed for easy learning curve of practicing and implementing friendly best practice of these technologies:

Tooling:

  • Terminal and zsh
  • Git

Documentation:

  • README
  • API Blueprint

Web Development:

  • JavaScript and Node.js
  • HTML, Handlebars, and EJS
  • CSS, PostCSS, and Stylus
  • npm, Yarn, and Bower
  • Express and Feathers
  • jQuery
  • Angular
  • Vue
  • React
  • Webpack
  • PM2

Web Application:

  • REST API
  • HTTP and CORS
  • Environment Variables

Database:

  • MongoDB
  • Mongoose ODM

Authentication:

  • Local Password
  • OAuth
  • Passport

Testing:

  • Mocha
  • Chai
  • PhantomJS
  • Nightmare

Continuous X:

  • Travis
  • Snap CI
  • Codeship

Development

Make sure you have installed the latest Node.js and npm. Afterwards, install the required global dependencies.

npm install -g nodemon live-server bower mocha vue-cli pm2

Then open server-* and client-* directory separately.

Server Express

npm install
npm run dev

Client jQuery

bower install
live-server

Deployment

TODO with PM2


Object Model

Accounts

{
  "name": String,
  "username": String,
  "email": String,
  "password": String,
  "createdAt": Date,
  "updatedAt": Date
}

Books

{
  "isbn": String,
  "name": String,
  "price": String,
  "createdAt": Date,
  "updatedAt": Date
}

API

Accounts

API Endpoint HTTP Description
auth/signup POST Sign up for new account
auth/sigin POST Sign in with existed account
api/accounts GET Get all accounts
api/accounts DEL Delete all accounts
api/accounts/:id GET Get one account by accountId
api/accounts/:id DEL Delete one account by accountId
api/accounts/:id PUT Update one account by accountId

Books

API Endpoint HTTP Description
api/books GET Get all books
api/books DEL Delete all books
api/books POST Post a new book
api/books/:isbn GET Get book by ISBN
api/books/:isbn DEL Delete book by ISBN
api/books/:isbn PUT Update book by ISBN

Test with cURL

Sign up for a new account

Request:

# admin
curl localhost:3000/auth/signup -X POST -d "[email protected]&name=administrator&username=admin&password=admin"

# test
curl localhost:3000/auth/signup -X POST -d "name=Tester&username=test&password=test&[email protected]"

Response:

{"token":"ey123456789.eyABCDEFGHIJKLMNOPQRSTUVWXYZ.ABC-XYZ"}%

Sign in with existed account

Request:

# admin
curl localhost:3000/auth/signin -X POST -d "username=admin&password=admin"

# test
curl localhost:3000/auth/signin -X POST -d "username=test&password=test"

Response:

{"token":"ey123456789.eyABCDEFGHIJKLMNOPQRSTUVWXYZ.ABC-XYZ"}%

Create new book

Request:

curl localhost:3000/api/books -X POST -d "isbn=121212&name=Twelve&price=12"

Response:

{"__v":0,"updatedAt":"2012-12-12T12:12:12.000Z","createdAt":"2012-12-12T12:12:12.000Z","isbn":"121212","name":"Twelve","price":12,"_id":"1234567890"}

License

MIT License

workshop-js's People

Contributors

mhaidarhanif avatar

Watchers

James Cloos avatar Ken Duigraha Putra avatar

Forkers

broerjuang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.