Skip to content

Instantly share code, notes, and snippets.

@charliewilco
Last active February 20, 2018 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charliewilco/2e44fe1d1ba23a8d6e36e0293a9df277 to your computer and use it in GitHub Desktop.
Save charliewilco/2e44fe1d1ba23a8d6e36e0293a9df277 to your computer and use it in GitHub Desktop.
dumb idea
const API = () => (
<Endpoints>
<Get path='/posts' render={(req, res, props) => (
<Mongoose schema={Post} find={req.params} />
)} />
<Post path='/posts' render={(req, res, props) => (
<Mongoose schema={Post} add={req.params} />
)} />
<Get path='/posts/:id' render={(req, res, props) => (
<Mongoose schema={Post} find={req.params.id} />
)} />
<Put path='/posts/:id' render={(req, res, props) => (
<Mongoose
schema={Post}
update={req.params.id}
payload={req.payload}
/>
)} />
<Delete path='/posts/:id' render={(req, res, props) => (
<Mongoose
schema={Post}
remove={req.params.id}
/>
)} />
</Endpoints>
)
const server = http.serve(<API />, 4000)
exports default server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment