• Minimal Docker container

    With Docker multi stage, you can use multiple base image (call as builder) to build necessary files, assets and copy stuff over to final image after.

    Here is some tricks:

    • You can use node:alpine, bitnami-docker-node or other smaller images if it’s enough to build your app.
    • Copy necessary files only
    • Base node docker image included yarn, it’s better some time (ex: build node-sass)


    # node builder
    FROM node:8.9.3 as nodebuilder
    RUN mkdir publish
    COPY gulpfile.js webpack.config.js package.json publish/
    COPY ./Vue publish/Vue
    COPY ./wwwroot publish/wwwroot
    WORKDIR /publish
    RUN cd /publish && yarn install \
        && yarn gulp all \
        && yarn run build
    # dotnet builder
    FROM microsoft/dotnet:2.0.0-sdk as builder
    RUN mkdir publish
    COPY . publish
    WORKDIR publish
    RUN dotnet restore <app_name>.csproj
    RUN dotnet publish <app_name>.csproj --configuration Release --output ./out
    # final image
    FROM microsoft/dotnet:2.0.0-runtime
    WORKDIR /dotnetapp
    COPY --from=builder publish/out .
    COPY --from=nodebuilder publish/wwwroot ./wwwroot
    ENTRYPOINT ["dotnet", "<app_name>.dll"]
  • XML to JSON - VSCode extension →

    Visual Studio Marketplace Visual Studio Marketplace Visual Studio Marketplace

    Convert XML from clipboard or current document/selection to JSON

    Are you using Code and working with XML builder tools day by day?

    XML to JSON can help you create the final object, just edit the variables that need dynamic data instead of typing each object key, attribute and no typos mistake. Converted data can be use for xmlbuilder or xml2js

  • Property lookup on booleans →

    Performs a lot of dynamic lookups on the Boolean.prototype, as the ToBoolean operation let’s true pass for obj (which might itself be concerning that this can be a boolean). Instead of the coercion, the code should properly check for valid objects via typeof and strict equality with null comparison.


    Use below

    if (typeof obj === "object" && obj !== null) {
        return obj[key] || 0
    return 0

    Instead of

    return (obj && obj[key]) || 0
  • pino-redis - first contribution

    Few months ago, I created a small project called pino-redis, a “transport” for the pino logger, receives pino logs from stdin and transform them into Redis.

    Yesterday, I decided add it into official transports documentation via PR #307. And now, it was there.

    It’s my first contribution to the open source community. You can find via npm or GitHub

  • Hello World! app with Node.js and Koa

    Install Node.js for your platform

    Open terminal and type

    mkdir hello-world; cd hello-world

    Initialize your project and link to npm

    Running this command initializes your project:

    npm init

    This creates a package.json file in your hello-world app folder and will prompt you to enter number of things. You can enter your way through all of them EXCEPT this one:

    entry point: (index.js)

    You will want to change this to


    Install Koa in the hello-world directory

    npm i koa koa-router

    --save is default option in node v8

    Start your text editor and create a file named as entry point

    const Koa = require('koa')
    const Router = require('koa-router')
    const app = new Koa()
    const router = new Router()
    router.get('/', ctx => {
        ctx.status = 200
        ctx.body = 'Hello, World'
    app.listen(3000, () => {
        console.log('app listening on port 3000')

    Run the app

    node <your_file_name>.js