Git Product home page Git Product logo

adeverywhere's Introduction

Directory structure

db -> Database for restful API

api -> restful api service written by nodeJS

nginx -> nginx config file

server -> Managuage site built with Vue2.0

docs -> documents

Projects

  1. MongoDB
  2. NodeJS (RestFul API)
  3. Vuex (Public server)

Start command

Using docker way

Following command based on root directory as working directory! Docker container name: ad_db, ad_api, ad_server, ad_nginx

MongoDB

sudo docker run -v "$(pwd)/db/data":/data --name ad_db  -p 8100:27017 -d mongo mongod --smallfiles 
#execute following command to initial db with test data
sudo docker exec -it ad_db /data/initdb.sh

NodeJS

cd ./api && npm install
sudo docker run -it -v "$(pwd)/api":/usr/src/app --name ad_api -p 8300:3000 -w /usr/src/app -d --link mongodb:mongo node npm start

AD-Server

cd ./server && npm install
docker run -it -v "$(pwd)/server":/usr/src/app --name $CONTAINER_SERVER --network $DOCKER_NET -p $SERVERPORT_O:$SERVERPORT_I -w /usr/src/app -d node npm run dev

Nginx

sudo docker run --name nginx -v "$(pwd)/nginx/default.conf":/etc/nginx/conf.d/default.conf -p 8080:80 -p 8443:443 --link nodejs:nodejs  -d nginx

Then access Restful API with: http://localhost:8080/api/ads

Tips

cd api && DEBUG=express* nodemon ->3000

cd server && PORT=4000 npm run dev ->4000

sudo /usr/local/nginx/sbin/nginx -c "$(pwd)/nginx/dev.conf"

##Docker port map: Mongodb : 8100 --> 27017 NodeJS(API): 8300 --> 3000 Server: 8400 --> 8080

TODOS

####################### #1. PORT=4000 npm run dev #2. DEBUG=express* nodemon #3. sudo /usr/local/nginx/sbin/nginx -c "$(pwd)/nginx/dev.conf" #######################

adeverywhere's People

Contributors

xiaosen83 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.