Skip to content

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

Notifications You must be signed in to change notification settings

ryanphung/chinese-hanviet-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published