Git Product home page Git Product logo

chinese-hanviet-api's Introduction

Overview

An API built using json-server based on the template json-server-heroku that allows you to look up Chinese and Han Viet cognates based on the data from chinese-hanviet-cognates.

I created it for personal usage in my Anki deck, where I can display the list of Hanviet words for every Chinese character that I learn.

Demo

Setting up

1 . Install dependencies

yarn install

2 . Sync the data from the source

yarn run sync

This script will download a tsv file from the source repo, and convert it to JSON format and write into db.json. If there is no change in the source file, you won't see any change in db.json. But if you intend to deploy this API to Heroku, make sure to commit any changes to db.json to git.

3 . Run the API

yarn start

This will start the API locally on port 3000.

4 . Access the API

You can query the API in many ways, for example:

For more flexible ways to query, refer to the complete documentation of json-server.


Deploy to Heroku

Heroku

Heroku is a free hosting service for hosting small projects. Easy setup and deploy from the command line via git.

Install Heroku

1 . Create an account on
https://heroku.com

2 . Install the Heroku CLI on your computer:
https://devcenter.heroku.com/articles/heroku-cli

3 . Connect the Heroku CLI to your account by writing the following command in your terminal and follow the instructions on the command line:

heroku login

4 . Then create a remote heroku project, kinda like creating a git repository on GitHub. This will create a project on Heroku with a random name. If you want to name your app you have to supply your own name like heroku create project-name:

heroku create my-cool-chinese-hanviet-api

6 . Push your app to Heroku (you will see a wall of code)

git push heroku master

7 . Visit your newly create app by opening it via heroku:

heroku open

8 . For debugging if something went wrong:

heroku logs --tail

For different ways to deploy the project, refer to the original template

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.