Git Product home page Git Product logo

simple-node-api's Introduction

-m 'init commit' Uses Json Web Tokens (https://jwt.io/), where FE will be sending requests with the JWT in the x-authentication-token header and PostgreSQL DB.

Install Dep

npm install

Set up database

(Assume PostgreSQL is already installed) In console: Update the database config in app.js to your credentials Run: CREATE TABLE users( email VARCHAR(40), password VARCHAR(80), firstname VARCHAR(20), lastname VARCHAR(20) );

Run Server

node app.js

Postman Calls

Sign-up Call: POST http://localhost:3000/signup

Header: [{"key":"Content-Type","value":"application/json","description":""}]

Body: { "email": "meret3", "password": "password2", "firstname": "firstname2", "lastname": "lastname2" }

Login Call: POST http://localhost:3000/login

Header: [{"key":"Content-Type","value":"application/json","description":""}]

Body: { "email": "[email protected]", "password": "password" }

Users Call (GET): GET http://localhost:3000/users

Header: [{"key":"x-access-token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Im1lcmV0MyIsImlhdCI6MTUyOTI2OTIyNCwiZXhwIjoxNTI5MzU1NjI0fQ.vZBBDg0n-PsnXKVlSE2yOnhRGlE_rdPJl8IKRCybeYI","description":""}]

  • Token is the token returned from sign-in or login

Users Call (PUT): PUT http://localhost:3000/users

Header: Header: [{"key":"Content-Type","value":"application/json","description":""}, {"key":"x-access-token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Im1lcmV0MyIsImlhdCI6MTUyOTI2OTIyNCwiZXhwIjoxNTI5MzU1NjI0fQ.vZBBDg0n-PsnXKVlSE2yOnhRGlE_rdPJl8IKRCybeYI","description":""}]

  • Token is the token returned from sign-in or login

Body: { "firstname": "lastfirstname", "lastname": " " }

simple-node-api's People

Contributors

stephalexis avatar stephaniejoymills avatar

Watchers

 avatar

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.