fastify / fastify-example-twitter Goto Github PK
View Code? Open in Web Editor NEWFastify example - clone twitter
License: MIT License
Fastify example - clone twitter
License: MIT License
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.
Hi,
I have a question around logging inside services.
Let say I would want to log some statements inside user service and it should also contain context information like requestId which would help in debugging production applications.
Is it possible to add some example for this use case?
In other words passing the context information or req.log across all operations.
I am getting the following exception while building the backend. Am I missing something?
I did,
npm install
npm start -- --log-level trace --port 3001
[email protected] start /Users/digvijay/tools/fastify-example-twitter/fastify-example-twitter
env-cmd local.env fastify start index.js "--log-level" "trace" "--port" "3001"
mongodb://localhost:27017/twitter
assert.js:669
assert.ifError = function ifError(err) { if (err) throw err; };
^
MongoError: unknown option to collMod: validator
at /Users/digvijay/tools/fastify-example-twitter/fastify-example-twitter/node_modules/mongodb-core/lib/connection/pool.js:581:63
at authenticateStragglers (/Users/digvijay/tools/fastify-example-twitter/fastify-example-twitter/node_modules/mongodb-core/lib/connection/pool.js:504:16)
at Connection.messageHandler (/Users/digvijay/tools/fastify-example-twitter/fastify-example-twitter/node_modules/mongodb-core/lib/connection/pool.js:540:5)
at emitMessageHandler (/Users/digvijay/tools/fastify-example-twitter/fastify-example-twitter/node_modules/mongodb-core/lib/connection/connection.js:310:10)
at Socket. (/Users/digvijay/tools/fastify-example-twitter/fastify-example-twitter/node_modules/mongodb-core/lib/connection/connection.js:453:17)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: env-cmd local.env fastify start index.js "--log-level" "trace" "--port" "3001"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/digvijay/.npm/_logs/2019-01-31T22_40_15_559Z-debug.log
C:\code\fastify\fastify-example-twitter\frontend>npm build
npm WARN build npm build
called with no arguments. Did you mean to npm run-sc ript build
?
https://github.com/fastify/fastify-example-twitter/blob/master/timeline/index.js#L51-L60
uses both async and a callback. Just use one.
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.
Since we did not receive a CI status on the greenkeeper/initial
branch, we assume that you still need to configure it.
If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/
.
We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.
as titled
This is not needed https://github.com/fastify/fastify-example-twitter/blob/master/index.js#L42-L55, you can remove the callback passed to next()
in the recent Fastify.
Something like:
module.exports = async function (fastify, opts) {
fastify
.register(require('fastify-swagger'), swaggerOptions)
.register(require('./user'), { prefix: '/api/user' }
//...
}
Add how to run this on local machine
docker run --rm -d -p 6379:6379 redis
docker run --rm -d -p 27017:27017 mongo
See #18
Hello everyone! I'm evaluating fastify, but facing some issues to run this project.
`➜ fastify-example-twitter git:(master) npm start -- --log-level trace --port 3001
[email protected] start /Users/lgertel/fastify-example-twitter
fastify index.js "--log-level" "trace" "--port" "3001"
AsyncFunction
assert.js:663
throw newErr;
^
AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Cannot destructure property ObjectId
of 'undefined' or 'null'.
at listen (/Users/lgertel/fastify-example-twitter/node_modules/fastify/node_modules/fastify-cli/cli.js:96:12)
at /Users/lgertel/fastify-example-twitter/node_modules/fastify/fastify.js:209:23
at Function._encapsulateThreeParam (/Users/lgertel/fastify-example-twitter/node_modules/avvio/boot.js:297:7)
at Boot.callWithCbOrNextTick (/Users/lgertel/fastify-example-twitter/node_modules/avvio/boot.js:252:5)
at release (/Users/lgertel/fastify-example-twitter/node_modules/fastq/queue.js:127:16)
at Object.resume (/Users/lgertel/fastify-example-twitter/node_modules/fastq/queue.js:61:7)
at Plugin.loadPlugin.call (/Users/lgertel/fastify-example-twitter/node_modules/avvio/boot.js:141:22)
at registerRoutes (/Users/lgertel/fastify-example-twitter/tweet/index.js:51:32)
at Plugin.exec (/Users/lgertel/fastify-example-twitter/node_modules/avvio/plugin.js:33:17)
at Boot.loadPlugin (/Users/lgertel/fastify-example-twitter/node_modules/avvio/plugin.js:114:10)
at Task.release (/Users/lgertel/fastify-example-twitter/node_modules/fastq/queue.js:127:16)
at worked (/Users/lgertel/fastify-example-twitter/node_modules/fastq/queue.js:169:10)
at toLoad.finish (/Users/lgertel/fastify-example-twitter/node_modules/avvio/plugin.js:117:7)
at done (/Users/lgertel/fastify-example-twitter/node_modules/avvio/plugin.js:74:7)
at check (/Users/lgertel/fastify-example-twitter/node_modules/avvio/plugin.js:86:7)
at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: fastify index.js "--log-level" "trace" "--port" "3001"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/lgertel/.npm/_logs/2018-05-30T20_49_55_734Z-debug.log
➜ fastify-example-twitter git:(master)`
I'm following the readme. Cloned the repo and tryed to run both dev and other option too.
Anyone can help me?
I need a feedback from @fastify/fastify here.
Any kind of feedbacks are appreciated. Really....
Hi,
Just a warning : The password in MongoDB is not encrypted.
🚨 May be don't use this example in Production ! 🚨
https://github.com/fastify/fastify-example-twitter/blob/master/timeline/index.js#L30-L32
There are probably other places as well.
Going through your implementation detail I have noticed the following things which I think are against the MicroServices concept/ Culture.
In your docker files I have noticed you are doing COPY . /usr/src/app , which is copying the same code base across all Micro Services.
e.g. You have tweets Micro Service and the timeline Micro Service; if for some reason you update the timeline Service since it is maintained in the same code base as my whole project it creates the problem of where your whole build version will change (i.e. the latest version for my tweets will also be updated).
To Summarize; i have attached an image from microservices.io and also what do you think of your current implementation according to suggestions made by https://microservices.io/patterns/microservices.html
Running 'docker-compose up' gives 'microservice' script missing error. Seems the 'CMD' command in docker file needs update.
Has not seen an update in 3+ years.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.