Code Monkey home page Code Monkey logo

node-api-mongo-docker's Introduction

Node API Circle CI

Coverage Status

An example of a dockerized node API built with hapijs, mongodb and mongoose.

Installation

$ npm install

Development

Watch *.js files and restart the server.

$ node start

Examples

Login with sample admin user:

$ curl -H "Content-Type: application/json" -X POST -d '{"email": "[email protected]", "password": "admin"}' http://localhost:9001/login

This will return a token replace <token> by that value and try retrieving the list of users:

$ curl -H "Authorization: Bearer <token>" http://localhost:9001/users

Tests

$ npm test

Coverage

$ npm run coverage

Lint

Run ESLint

$ npm run lint

Docker

Install Docker and Compose

Start docker and run:

$ docker-compose up

See docker-compose.yml and Dockerfile

Will install al dependencies, and run the api server in production mode.

Image at DockerHub dciccale/node-api-mongo-docker

Continuous Integration

With CircleCI, see circle.yml

Build url: https://circleci.com/gh/dciccale/node-api-mongo-docker

node-api-mongo-docker's People

Contributors

dciccale avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

krsandesh

node-api-mongo-docker's Issues

Docker volume error

Hello,

I have exactly the same setup as you but running this on the latest version of docker doesn't work anymore.

After running docker-compose up you get an error from npm saying the package.json file is not present.

npm ERR! enoent ENOENT: no such file or directory, open '/home/api/package.json'

This is because your are mounting this volume:

volumes:
    - ".:/home/api"

If I'm to remove this, create the image and run a container on it, works.

So my guess is that docker now removes everything when you mount a volume pointing to the same folder where the image was created.

How would you fix something like this and keep the same folder structure?

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.