Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Plugin to share a common GunDB connection across Fastify 🔫

License

NotificationsYou must be signed in to change notification settings

lmangani/fastify-gundb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastify-gundb

js-standard-styleBuild Status

FastifyGunDB connection plugin, with this you can share a Gun instance in every part of your server.

Install

npm i fastify-gundb --save

Usage

Add it to you project withregister and you are done!
You can access Gun viafastify.gun.

constfastify=require('fastify')fastify.register(require('fastify-gundb'),{name:'db'},err=>{if(err)throwerr})fastify.get('/foo',(req,reply)=>{const{ gun}=fastify.gungun.get(req.query.key).once(function(val){if(!val)val={status:404}reply.send(val)})})fastify.post('/foo',(req,reply)=>{const{ gun}=fastify.gungun.get(req.body.key).put(req.body.value,(ack)=>{if(!ack)val={status:'error'}reply.send({status:'ok'})})})fastify.listen(3000,err=>{if(err)throwerrconsole.log(`server listening on${fastify.server.address().port}`)})

Acknowledgements

This project is kindly sponsored by:

Fastify is kindly sponsored by:

License

Licensed underMIT.

About

Plugin to share a common GunDB connection across Fastify 🔫

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp