Skip to content

Instantly share code, notes, and snippets.

View kop7's full-sized avatar
🎯
Focusing

Matija Kop kop7

🎯
Focusing
View GitHub Profile
version: "3.7"
services:
nest-app:
build: server
container_name: nest-app
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:3000/api/healthcheck || exit 1"]
interval: 50s
timeout: 30s
import Vue from 'vue'
import Router from 'vue-router'
import Home from "@/components/Home";
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
{ path: '/', redirect: { name: 'home' } },
{ path: '/home', name: 'home', component: Home },
import "@babel/polyfill";
import Vue from "vue";
import "./plugins/boostrap-vue";
import App from "./App.vue";
import router from "./router";
Vue.config.productionTip = false;
new Vue({
router,
<template>
<b-container>
<br>
<b-list-group>
<h2 align="center">Search Movies by title</h2>
<b-input-group-text>
<b-input label="Search" type="text" v-model="search" placeholder="Search in 91,770 movies" />
<span class="input-group-text">Total: {{total}}</span>
</b-input-group-text>
<br>
<template>
<div id="app">
<router-view/>
</div>
</template>
import Vue from "vue";
import BootstrapVue from "bootstrap-vue";
import "bootstrap/dist/css/bootstrap.min.css";
import "bootstrap-vue/dist/bootstrap-vue.css";
Vue.use(BootstrapVue);
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ConfigService } from './config/config.service';
async function bootstrap() {
const configService = new ConfigService('.env');
const app = await NestFactory.create(AppModule);
app.enableCors();
app.setGlobalPrefix(configService.get('GLOBAL_PREFIX'));
await app.listen(configService.get('NODE_PORT'));
@kop7
kop7 / search.service.ts
Created August 12, 2020 18:51
Search Service
import { Injectable } from '@nestjs/common';
import { ElasticsearchService } from '@nestjs/elasticsearch';
import * as moviesJson from '../../../movies.json';
import { ConfigService } from '../../config/config.service';
interface MoviesJsonResponse {
title: string;
year: number;
cast: string[];
genres: string[];
@kop7
kop7 / search.module.ts
Created August 12, 2020 18:50
Search Module
import { Module, OnModuleInit } from '@nestjs/common';
import { SearchService } from './search.service';
import { ElasticsearchModule } from '@nestjs/elasticsearch';
import { ConfigModule } from '../../config/config.module';
import { ConfigService } from '../../config/config.service';
@Module({
imports: [
ElasticsearchModule.registerAsync({
imports: [ConfigModule],
@kop7
kop7 / movie.service.ts
Created August 12, 2020 18:49
Movie Service
import { Injectable } from '@nestjs/common';
import { SearchService } from '../search/search.service';
@Injectable()
export class MovieService {
constructor(readonly esService: SearchService) {}
async findMovies(search: string = '') {
return await this.esService.search(search);
}