This post presents the configuration snippet from nginx that redirects all request to https://www.codingmarks.org:

# redirect HTTP to www
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name codingmarks.org www.codingmarks.org;

    return 301 https://www.codingmarks.org$request_uri;
}

# redirect HTTPS to wwww
server {
    listen 443;
    server_name codingmarks.org;

    return 301 https://www.codingmarks.org$request_uri;
}

Note the missing www.codingmarks.org in the second server/server_name entry, to avoid an infinite loop

Lots of other good Nginx resources can be found by searching for the nginx tag on codingmarks: https://www.codingmarks.org?q=[nginx]

Octocat Source code for codingmarks.org is available on Github - frontend and backend.

This blog post presents a simple example showing how to insert a document in mongodb, in the Java language.

Octocat The code examples are taken from the Free-Programming-Books-Importer, available on Github

Use MongoDB Java Driver

Add the java mongo driver to your class path, or if you use maven to the dependencies in your pom file:

<dependencies>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver</artifactId>
        <version>3.2.2</version>
    </dependency>
    ......
</dependencies>

Prepare the Mongo Client

MongoClientURI connectionString = new MongoClientURI("mongodb://codingpedia:codingpedia@localhost:27017/codingpedia-bookmarks");
MongoClient mongoClient = new MongoClient(connectionString);
Continue Reading ...

I am really happy to announce that we’ve reached and surpassed our goal of 1Mb of #codingmarks. This was possible by importing the free programming books from the Free-Programming-Books project, which is one of the most starred repository on GitHub.

You can look for all imported free books by typing [free-programming-books] (tag filtering) in the search bar, or by provide it as query parameter: https://www.codingmarks.org/search?q=Bfree-programming-books%5D. Either way you should get a result similar to the following:

Results when search for free-programming-books tag
Continue Reading ...

In this guide we are going to:

  • install the latest NGINX version in Ubuntu 16.04.1
  • understand configuration files
  • generate SSL certificates and configure them in NGINX
  • configure NGINX as reverse proxy

NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. We use it in the #codingmarks project as web server to serve static files and as a reverse proxy for the NodeJS API and Keycloak Server:

Network Diagram

Continue Reading ...

Last week I migrated the codingmarks project to use Angular CLI and it’s awesome. Initially it was based on Angular Seed with Webpack - preboot/angular-webpack. I couldn’t take the update breaking changes pain anymore when I wanted to add Ahead-Of-Time compilation1 support. My webpack2 configuration was also getting out of hand. But I did it, I moved it to Angular CLI and in this post I am going to list the major steps I had to take. It is based on the Moving your project to Angular CLI story with my own needs and flavor added to it.

Continue Reading ...