https://github.com/zoltan-nz/koa-ts-contacts-app
REST API demo application with TypeScript, Koa.js
https://github.com/zoltan-nz/koa-ts-contacts-app
koa2 koajs nodejs typescript
Last synced: 3 months ago
JSON representation
REST API demo application with TypeScript, Koa.js
- Host: GitHub
- URL: https://github.com/zoltan-nz/koa-ts-contacts-app
- Owner: zoltan-nz
- Created: 2017-05-01T09:44:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-27T01:05:22.000Z (almost 8 years ago)
- Last Synced: 2024-10-12T22:31:58.649Z (about 1 year ago)
- Topics: koa2, koajs, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 129 KB
- Stars: 4
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# koa-ts-contacts-app
Building a simple contact management REST API using Node.js, TypeScript, Koa.js.
**Requirements**
* MVC pattern
* Dependency Injection
* Authentication
* Database, MongoDB support, migration
* Models: Contact, Category
* REST API, Json interface
* Unit tests**Useful links:**
* [Article 1](http://mherman.org/blog/2017/08/23/building-a-restful-api-with-koa-and-postgres/)
* [Article 2](https://devdactic.com/restful-api-user-authentication-1/)**Packages**
Build:
* TypeScript
* TSLint
* ts-node
* chockidar
* concurrentlyUsing direct command line tools with npm script.
Test:
* Jest (or Mocha)
Core:
* Koa
Database:
* Sequalizer
* MongooseAuthentication
* Passport?
**Requirements**
Data models
* contact
* category
* user```
Contact
- id
- name (string)
- email (string)
- category (belongsTo)Category
- id
- name
- contacts (hasMany)User
- id
- username
- password
```*Resource endpoints*
| path | method | |
|:--- |:--- | --- |
|`/api/categories`| GET | list all record |
|`/api/categories`| POST | create a new category record |
|`/api/categories/:id`| GET | get the individual record |
|`/api/categories/:id`| PUT | update the whole record |
|`/api/categories/:id`| DELETE | get the individual record |
|`/api/contacts`| GET |
|`/api/contacts`| POST|
|`/api/contacts/:id`| GET |
|`/api/contacts/:id`| PUT |
|`/api/contacts/:id`| DELETE|*Authentication*
Following Passport.js patterns: http://www.passportjs.org/docs/authenticate/
## Changelog
* Create `/api/categories` route
* Add test
* Add implementation## Other Notes
* Investigating RESTyped: https://github.com/rawrmaan/restyped
* [Article](https://blog.falcross.com/introducing-restyped-end-to-end-typing-for-rest-apis-with-typescript/)