Sign inSign up

savelee/docker-node-server

By savelee

•Updated over 10 years ago

Node with MongoDB, back-end for Sencha Ext JS 6 client: https://github.com/savelee/docker-ext-client

Image
0

10K+

savelee/docker-node-server repository overview

⁠Node JS, Express and MongoDB - user back-end

This is an example of a Node.js user application, with Express, MongoDb and Passport user authentication.The code can be found on Github: https://github.com/savelee/docker-ext-client⁠, https://hub.docker.com/r/savelee/docker-ext-client/⁠

This code provides a REST webservice. It becomes handy, when using a client application. For this example, I used this Ext JS 6 client app: https://github.com/savelee/docker-ext-client⁠

⁠How to use this image?

$ docker pull savelee/docker-node-server $ docker run --name nodeapp -p 9000:9000 -d savelee/docker-node-server

⁠Configuring this application locally.

This application doesn't do much without a proper back-end. We can serve this with a valid Node.js, Express, MongoDB server.

The code can be found here:

https://github.com/savelee/docker-node-server⁠ Run with nodemon app.js

To create an admin account, use Curl or Postman:

$ curl -H "Content-Type: application/json" -X POST -d '{ "username" : "admin", "password": "admin" }' http://127.0.0.1:9000/register

We will use this client: https://github.com/savelee/docker-ext-client⁠

You will need to edit the app/utils/Contants.js file to:

Ext.define('Client.utils.Constants', {
    singleton: true,

    'LIVE_URL': window.location.protocol + "//" + window.location.host + ':9000',

    'TOKEN_PREFIX': '',
    'DISABLE_TOKEN': false
});

Then you can start the Ext JS app locally with: sencha app watch Open your browser, and browse to: http://127.0.0.1:1841⁠, and login with your admin account.

⁠Configuring this application with Docker Compose

First make an Ext JS build: sencha app build

Create a docker-compose.yml

client:
    build: ./client
    restart: always
    ports:
      - "80:80"
    links:
      - server
server:
    build: ./server
    restart: always
    ports:
     - "9000:9000"
    links:
     - mongo
mongo:
  image: mongo
  command: --smallfiles
  restart: always
  ports:
    - "27017:27017"

Tag summary

Content type

Image

Digest

Size

251.9 MB

Last updated

over 10 years ago

docker pull savelee/docker-node-server