https://github.com/erfanium/symbolism
RPC-based HTTP micro-framework with using javascript's symbol magics
https://github.com/erfanium/symbolism
Last synced: 6 months ago
JSON representation
RPC-based HTTP micro-framework with using javascript's symbol magics
- Host: GitHub
- URL: https://github.com/erfanium/symbolism
- Owner: erfanium
- License: mit
- Created: 2020-09-10T19:43:55.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-14T14:47:00.000Z (almost 6 years ago)
- Last Synced: 2025-02-05T12:45:32.549Z (over 1 year ago)
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# symbolism
RPC-based HTTP micro-framework with using javascript's symbol magics
Stage: idea
### Demo
```js
import { statusCodeSym, bodySym, urlSym } from 'symbolism'
export function getPosts() {
return Posts.find({})
}
export function createPost(params) {
return Posts.create(params)
}
export function echoUrl(params) {
return {
[bodySym]: params[urlSym],
[statusCodeSym]: 200
}
}
export function echoHeaders(params) {
return {
[bodySym]: params[headersSym],
}
}
symbolism.get('/posts', getPosts)
symbolism.post('/posts', createPost)
symbolism.get('/url', echoUrl)
symbolism.get('/headers', echoHeaders)
```
### Why?
- no more `request` - `reply/response` objects and its sucks
- crazy easy to test, beacuse there's no need to mock `request/reply` objects
- everything is just simple functions - no extra dependencies in code