Code Monkey home page Code Monkey logo

sample-api's Introduction

sample-api

Introduction

This is a barebones API for node.js including the following features:

  • Users and authentication
  • Hashed/salted passwords
  • User roles
  • Routes for basic CRUD operations
  • Routes for search operations
  • Error logging
  • Unit testing for individual functions
  • Integration testing for routes

Technologies Used

Http Routing
  • node.js
  • express
Database
  • postgresql
  • sequelize
Authentication
  • jwt-simple (json-web-tokens)
Testing
  • mocha
  • chai
  • chai-http
  • proxyquire

Dependencies

Required installs:

  • node.js
  • postgresql

Once you have installed postgresql, open the terminal and create the database and user:

You will need to create a database called sample_api:

createdb sample_api

Next, start up psql and connect to the sample_api database:

psql sample_api

Create a user and grant access to sample_api database:

CREATE USER svc_sampleapi_dev WITH PASSWORD 'P6zIAwuvuNWo';
GRANT ALL PRIVILEGES ON DATABASE "sample_api" to svc_sampleapi_dev;

You should now be able to run npm install and then npm start. Sequelize will produce all of your database tables on startup.

Running Tests

All tests

npm test

From the terminal:

Unit tests only

npm run unitTest

Integration tests only

npm run integrationTest

sample-api's People

Contributors

dw1284 avatar

Stargazers

 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.