Giter VIP home page Giter VIP logo

node-koa-api's Introduction

RESTful API with Koa, Passport, Redis, and Postgres

Build Status

Want to learn how to build this project?

Check out the following blog posts:

  1. Building a RESTful API with Koa and Postgres
  2. User Authentication with Passport and Koa

Want to use this project?

  1. Fork/Clone
  2. Install dependencies - npm install
  3. Fire up Postgres and Redis on the default ports
  4. Create two local Postgres databases - koa_api and koa_api_test
  5. Migrate - knex migrate:latest --env development
  6. Seed - knex seed:run --env development
  7. Sanity check - npm start
  8. Test - npm test

node-koa-api's People

Contributors

mjhea0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-koa-api's Issues

3 tests fail on branch v2

Pulling the branch v2 from the repo, I would expect all tests to run successfully, but in fact three fail:

  • POST fails, because only the inserted id is returned, and not the object itself
  • PUT fails, returns error code and no update made
  • DELETE fails, also returns error and no delete made

router uses prefix

const router = new Router();
const BASE_URL = `/api/v1/movies`;

You can use this:

const router = new Router({prefix:"/api/v1/movies"})

[Database Connection] - Error while running tests

  • Create knex mecanism to run tests in every other machine

knexjs Doc

var knex = require('knex')({
  client: 'mysql',
  connection: {
    host : '127.0.0.1',
    user : 'your_database_user',
    password : 'your_database_password',
    database : 'myapp_test'
  },
  migrations: {
    tableName: 'migrations'
  }
});

Solution

connection: {
      host: 'localhost',
      user : 'postgres',
      password : '****',
      database : 'koa_api_test'
    }

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.