Coder Social home page Coder Social logo

sarisen / eksisozluk-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coluck/eksisozluk-api

0.0 0.0 0.0 781 KB

Unofficial eksisozluk.com API - Resmi olmayan ekşi sözlük API'si

Home Page: https://eksisozluk-api.herokuapp.com/doc

License: MIT License

Shell 0.05% JavaScript 73.83% CSS 6.37% HTML 19.75%

eksisozluk-api's Introduction

eksisozluk-api

Unofficial eksisozluk.com API - Resmi olmayan ekşi sözlük API'si.


Ekşi sözlük için geliştirilmiş node.js tabanlı server API. Ekşisözlükten çekilen veriler json formatında kullanıcıya geri döndürülür. 5 controller içerisinde 7 tane endpoint barındıran bu API'yi kolaylıkla kendi bilgisayarınızda çalışır hale getirebilirsiniz.

doc [Heroku dokümantasyon]

client [Heroku örnek vue.js client'ı]

İçindekiler


Kurulum

Terminalde sırasıyla şu komutları çalıştırın:

$ git clone https://github.com/coluck/eksisozluk-api.git
$ cd eksisozluk-api
$ npm i
$ npm run serve

Demo

API'nin demo'suna buradan ulaşabilirsiniz: eksisozluk-api: documantation demo eksisozluk-api: client demo

Heroku'nun ücretsiz paketi ile deploy edilmiştir. Çok fazla yüklenmeyin :)


Api Endpointleri

method endpoint açıklama
get api/basliklar gündemdeki başlıkları getirir
get api/baslik/:slug spesifik bir başlığı getirir
get api/debe debe'yi getirir (yavaş çalışır)
get api/entry/:id spesifik bir entry'i getirir
get api/biri/:nick bir suser'ı getirir(TODO: calismiyor )
get api/ara/:query arama sonucunu getirir
get api/autocomplete/:query otomatik tamamlama özelliği

API tamamen GET metot'larından oluşmaktadır. eksisozluk.com'dan çektiği veri'leri uygun bir json formatında geri döner.


Api Dokümanı

API'yi çalıştırdıktan sonra /doc adresinden API'nin dokümantasyonuna ulaşabilirsiniz. Buradaki doküman apidoc modülü ile oluşturuldu. Screenshot_2020-12-05 eksisozluk-api doc

Dokümantasyonu tekrar derlemek için şu komutu çalıştırın: npm install --save-dev (apidoc modülünü indirmek için) npm run docg


Ayarlar

Ayarları config.js dosyası ile düzenleyebilirsiniz. useMongo ve cacheAPI değişkenleri sadece debe controller'ı için kullanılır.(bkz: notlar)

require("dotenv").config();
const config = {
  apiEnpoint: "/api",
  serveDoc: true,
  serveClientEx: true,
  docEndpoint: "/doc",
  clientEndpoint: "/",
  useMongo: process.env.USE_MONGO || false,
  cacheAPI: process.env.CACHE_API || false,
  limitAPI: process.env.LIMIT_API || false,
};

".env.example" dosyasının '.example' uzantısını silerek saklanması gereken verileri bu dosyada tutabilirsiniz.

USE_MONGO=true
CACHE_API=true
DB_URL=mongodb://127.0.0.1:27017/db_name

Örnek Uygulama

Bu repo'nun içinde bu API'yi tüketen/kullanan bir frontend web uygulaması mevcut. Bu uygulama vue.js ile kodlandı. "/public/dist" dizininde derlenmiş hali var. Vue.js uygulamasının kaynak koduna buradan ulaşabilirsiniz: eksisozluk-api-client

Uygulamanın Ekran Görüntüsü: eksisozluk-api-client


Notlar

Debe'yi getiren fonksiyon tüm entrileri tek tek çektiği için yavaş çalışmaktadır. Bu sorunu çözebilmek için 2 yöntem kullanıldı.

  1. Debe'yi mongodb'ye kaydetmek ve çekmek. (env dosyasında mongodb'nin url adresi düzenlenmeli ve "useMongo=true" ataması yapılmalı. Böylelikle günlük debe, veritabanına kayıt edilir.)

  2. Debe objesini cache'lemek. (node-cache modülü kullanıldı.)

Bu yöntemler ile debe.getDebe fonksiyonu ilk çağrıdan sonraki çağrılarda performans artışı sağlar.

Destek

Aşağıdakiler memnuniyetle karşılanır.

  • Hata bildirimi
  • Pull request
  • Sunucu sağlama

eksisozluk-api's People

Contributors

coluck avatar emreisik95 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.