A
A
Andrew2019-02-14 09:40:08
C++ / C#
Andrew, 2019-02-14 09:40:08

Setting up Nginx on digital ocean for a vue/express app?

I deployed my application to digital ocean without any problems, however, when the question arose about connecting an SSL certificate, I turned to the documentation on setting up SSL, which refers to this article on setting up a server block . Having done everything according to them, everything stopped working for me, as usual. Nginx is up and running, but the page (simple html created in nginx'a folder) doesn't load.
There are no errors in the console.
Another question is how, after nginx is up and running, hang up the application on node there? I have a small template break here, because I will have a server on both node and nginx. Of course, things are somewhat different, but nonetheless.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman, 2016-08-12
@MADm

Json.Net does what you need.
Here is a small example:

using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace JsonTest
{
    public class Deserialized
    {
        public class Region
        {
            public class Domain
            {
                public string code { get; set; }
                public string name { get; set; }
                public int id { get; set; }
            }

            public string code { get; set; }
            public string countryCode { get; set; }
            public string name { get; set; }
            public int id { get; set; }
            public Domain domain { get; set; }
        }

        public Dictionary<int, Region> regions { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string json = @"{
                ""regions"": {
                    ""937"": {
                      ""code"": ""Russia"",
                      ""countryCode"": ""ru"",
                      ""name"": ""Россия"",
                      ""id"": 937,
                      ""domain"": {
                        ""code"": "".ru"",
                        ""name"": ""Росийская Федерация"",
                        ""id"": 175
                      }
                    },
                    ""979"": {
                      ""code"": ""Bryansk,Bryansk Oblast,Russia"",
                      ""countryCode"": ""ru"",
                      ""name"": ""Брянск"",
                      ""id"": 979,
                      ""domain"": {
                        ""code"": "".ru"",
                        ""name"": ""Росийская Федерация"",
                        ""id"": 175
                      }
                    }
                  }
            }";

            Deserialized data = JsonConvert.DeserializeObject<Deserialized>(json);
        }
    }
}

V
Valery Osipov, 2016-08-12
@Namolem

I have exactly the same situation, but in Java.

public static class OrderBasketTypeAdapter implements JsonDeserializer<OrderDto.Basket> {
    @Override
    public OrderDto.Basket deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        Set<Map.Entry<String, JsonElement>> entries = json.getAsJsonObject().entrySet();
        OrderDto.Basket result = new OrderDto.Basket();
        for (Map.Entry<String, JsonElement> entry : entries) {
            OrderDto.Basket.BasketItemDto item = context.deserialize(entry.getValue(), OrderDto.Basket.BasketItemDto.class);
            result.items.add(item);
        }
        return result;
    }
}

R
Rou1997, 2016-08-12
@Rou1997

It is not necessary to access by key, you can simply access the array of all object branches (child nodes).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question