A corpus (words, synonyms, linguistics) RESTful API
Requirements:
- Node.js
- npm
Tech stack:
- TypeScript
- Express
- TypeORM
How to use:
Ctrl+Shift+B -> Build backend
(or runnpx tsc
command inbackend
directory)Ctrl+Shift+B -> Watch build backend
to run a watcher to build when changes are made
API authentication with JSON Web Tokens (JWT)
Tech stack:
- Angular
- TypeScript
- axios
- Make a new branch for the feature
- Push code to the branch
- Add needed tests
- Make a pull request when completed
Route | Request body | Response body | Description |
---|---|---|---|
GET /phrases | text : string - the phrase textid : integer - the ID of the phrasesynonym : Synonym[] - an array of synonyms |
Gets all the existing phrases | |
GET /phrases/:phraseid | text : string - the phrase textid : integer - ID of the phrase |
Gets one specific phrase | |
POST /phrases | text : string - the text for the new phrase |
text : string - the text of the phraseid : integer - the ID of the phrase |
Adds one phrase |
PUT /phrases | phraseid : number - ID of specified phrasetext : string - new text for the to-be changed phrase |
json : status - 200 ok response |
Changes the text of the synonym |
DELETE /phrases | ids : number[] - IDs of phrases |
deleted : number[] - array of IDs for the deleted phrases |
Deletion of one or more phrases through IDs |
Route | Request body | Response body | Description |
---|---|---|---|
GET /synonyms | id : integer - ID of the synonymphrase : Phrase - object of the phrasemeaning : Phrase - object of the phrase set as meaninggroup : Group - object of the group |
Gets all the existing synonyms | |
GET /synonyms/:id | id : integer - ID of the synonymphrase : Phrase - object of the phrasemeaning : Phrase - object of the phrase set as meaninggroup : Group - object of the group |
Gets one specific synonym | |
POST /synonyms | phrase : integer - ID of phrase meaning : integer - ID for the meaning of the phrasegroup(optional) : integer - ID for the suitable customer group |
id : integer - ID of the synonymphrase : Phrase - object of the phrasemeaning : Phrase - object of the phrase set as meaninggroup : Group - object of the group |
Adds a synonym |
PUT /synonyms/:id | phrase : integer - ID of phrase meaning : integer - ID for the new meaninggroup(optional) : integer - ID for the new/old group |
id : integer - the ID of the synonymphrase : integer - ID of phrasemeaning : integer - ID for the new meaninggroup : integer - ID for the new/old group |
Changes the meaning and optionally the group of the synonym |
DELETE /synonyms | ids : number[] - IDs of synonyms |
deleted : number[] - array of IDs for the deleted synonyms |
Deletion of one or more synonyms through IDs |
Route | Request body | Response body | Description |
---|---|---|---|
GET /groups | name : string - name of the groupid : integer - ID of the group |
Gets all existing customer groups | |
GET /groups/:id | name : string - name of the specified groupid : integer - ID of the specified group |
Gets one specific customer group out of all existing groups | |
POST /groups | name : string - the name for the new group |
name : string - the name of the groupid : integer - the id of the group |
Adds a customer group |
PUT /groups/:id | name : string - new name for the group |
json : status - 200 ok response |
Change the name of a customer group |
DELETE /groups | ids : number[] - IDs of groups to be deleted |
deleted : number[] - array for the deleted group IDs |
Deletion of one or more customer groups through IDs |
Route | Request body | Response body | Description |
---|---|---|---|
POST /translations | text : string - text to translategroups : number[] - groups to find synonyms by (max 1) |
translation : string - translated text |
Translates a piece of text based on synonyms Grouped synonyms are prioritized over global synonyms |