Skip to content

Instantly share code, notes, and snippets.

View sabljakovich's full-sized avatar

Hamza Sabljakovic sabljakovich

View GitHub Profile
{
"t":{
"$date":"2022-05-24T12:55:24.811+00:00"
},
"s":"I",
"c":"COMMAND",
"id":51803,
"ctx":"conn176",
"msg":"Slow query",
"attr":{
{
"t":{
"$date":"2022-05-24T12:51:54.623+00:00"
},
"s":"I",
"c":"COMMAND",
"id":51803,
"ctx":"conn173",
"msg":"Slow query",
"attr":{
Key Value
accept application/json, text/plain, */*
content-type application/json
user-agent axios/0.24.0
content-length 14
host localhost:3000
connection close
Key Value
accept application/json, text/plain, */*
content-type application/x-www-form-urlencoded
user-agent axios/0.24.0
content-length 8
host localhost:3000
connection close
package com.sabljakovic.mongospringdemo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
package com.sabljakovic.mongospringdemo;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ProductsRepository extends MongoRepository<Product, String> {
}
package com.sabljakovic.mongospringdemo;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document
public class Product {
@Id
private String productId;
@sabljakovich
sabljakovich / create-gitignore.sh
Created April 24, 2021 15:30
Create a NodeJS .gitignore file
# Navigate to the folder where you want to create the gitignore file
curl https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore -o .gitignore
@sabljakovich
sabljakovich / OpenAPIConfigurationAndControllerExample.java
Created January 1, 2021 22:21
Adds basic auth authorization option to a specific endpoint
@Configuration
@SecurityScheme(
name = "basicAuth", // can be set to anything
type = SecuritySchemeType.HTTP,
scheme = "basic"
)
@OpenAPIDefinition(
info = @Info(title = "Sample API", version = "v1")
)
class DocsConfiguration {
@sabljakovich
sabljakovich / OpenAPIConfiguration.java
Created December 30, 2020 00:53
Adds basic auth UI to OpenAPI / Swagger docs
@Configuration
@SecurityScheme(
name = "basicAuth", // can be set to anything
type = SecuritySchemeType.HTTP,
scheme = "basic"
)
@OpenAPIDefinition(
info = @Info(title = "Sample API", version = "v1"),
security = @SecurityRequirement(name = "basicAuth") // references the name defined in the line 3
)