Hey all! (TLDR at the bottom if you don’t care for context)So I’m not new to programming, but I’m definitely new to node. My background is in languages like C# and Java, just for context; basically nothing web-based.Recently to help teach myself the language, I’m putting together a hobby app. The premise isn’t important for the moment, but I’ll be doing a whole lot of interaction with a database full of information.It’s a pre-existing dataset that I’ll be working with, and it has about 26,000 records in it. The issue is that before I can actually use that data for what I want, I need to take that raw data and combine it into a wholly different data format, which will group a lot of those records together and do some math on them. To help visualize, it’s sports data, and the initial raw data I have is every historical season individually - so a player, a year, a team, and stats for that year. So one player could have many different seasons. I want to create a new data set organized by player, and each player document will have an array underneath it with all of their associated seasons.So the organization and transformation piece isn’t so bad. I’ve successfully gotten it to take in a season, validate whether or not it already has a player created, and then appropriately either create a player, create a season under a player, or nothing for duplicates.The problem comes in now running that for the entire DB of 26000 records. You can assume what happened: I query for all records, send that array to a function, and then attempted to just do a foreach over the array and call my converter function for each case.And of course, that didn’t work. It sure did call the function about 20000 times, but I think I functionally overloaded my DB with requests, and finally mongo just force-closed the connections, and it didn’t finish. I configured mongoose to allow me 20 open connections, rather than 5; I also upped the timeout to 10 minutes. Got more stuff done, but ultimately the same thing happened.Moreover, since I do kinda need to do this in order (so that player objects can be created, and then latter objects can come in and be grouped under the first object), I’d like a way to do this synchronously, or at the very least, do it in small batches with a configurable delay. I don’t actually care if it takes 5 hours or something - this is just a one-time process to get my data in place the first time, so I can actually do a cool thing with it.So TL;DR - how do take asynchronous actions (I.e, interacting with MongoDB) and make them synchronous so they execute in sequence? I’m using mongoose for schema and models.
Submitted November 01, 2019 at 05:04AM by Dreadmaker
Thursday, 31 October 2019
Tutorial: Node 12 LTS + Gulp 4 + VS2019
https://medium.com/@tristolliday/tutorial-node-12-lts-gulp-4-visual-studio-vs2019-85af5179f193?source=friends_link&sk=8712bb3a4897ffa45927d9464a371a2b
Submitted October 31, 2019 at 09:56PM by congolomera
Submitted October 31, 2019 at 09:56PM by congolomera
Question about some code
https://github.com/hakarapet/nodejs-design-patterns/blob/master/design_patterns/factory/libs/Response.jsI am wondering if the rObj would lead to some kind of memory leak. I don't think it's possible, because const is block-scoped and all of the used heap and stack gets flushed out after the request get through, but I am wondering if I might be wrong.
Submitted October 31, 2019 at 10:14PM by jesusscript
Submitted October 31, 2019 at 10:14PM by jesusscript
recommendation for super productive REST API framework
I'm looking for a framework that can help me quickly build a restful API that exposes a typical relational data model. I'm concerned more with productivity than customizability. Ideally I would like to be able to define a data model and have migrations, data access, routing all abstracted away. I'm not sure such a thing exists, but I would like to get as close to that as possible.
Submitted October 31, 2019 at 09:34PM by wagonn
Submitted October 31, 2019 at 09:34PM by wagonn
next-state: simple event-driven state machine, originally created for nodertc/dtls
https://github.com/reklatsmasters/next-state
Submitted October 31, 2019 at 09:50PM by dtsvet
Submitted October 31, 2019 at 09:50PM by dtsvet
Node Modules Team Reaches Consensus on Unflagging ES Modules Support in Node
https://twitter.com/MylesBorins/status/1189618753065144322?s=20
Submitted October 31, 2019 at 06:09PM by jamesaw22
Submitted October 31, 2019 at 06:09PM by jamesaw22
Twitter API Help
I'm working on a project that uses the Twitter API, and I've been able to learn how to get authenticated with Passport.js and implemented sign-in via Twitter (The Net Ninja's tutorial on Youtube was a life-saver). However, I've been stuck for the last couple of days on trying to figure out how to authenticate further requests with the twitter API past sign in. Such as following users, posting tweets, anything that really requires a User Access Token and an OAuth Signature. The twitter api docs for following users haven't really been much help as I'm new to the "Authentication" part of web development. Does anyone have any tips that could help me get out of this rut?
Submitted October 31, 2019 at 06:16PM by RundownDuck
Submitted October 31, 2019 at 06:16PM by RundownDuck
Anyone NOT using an ORM in production with Node? How do you organize your queries?
No text found
Submitted October 31, 2019 at 01:15PM by brodega
Submitted October 31, 2019 at 01:15PM by brodega
What is a Stack and why is it needed? (16-Bit Virtual Machine in JavaScript 003)
https://www.youtube.com/watch?v=mamop8aqFNk
Submitted October 31, 2019 at 02:29PM by FrancisStokes
Submitted October 31, 2019 at 02:29PM by FrancisStokes
[Help] The best strategy to check for users in passportjs async workflow
I am new to node development and authentication with oauth. I'm using passportjs with a oauth strategy in a express app. I need to check if the user exists in my API (decoupled from the backend) so my initial thought was check for users in the passport strategy callback with an API call, but I have learnt that await and a callback cannot be used at the same time.Later I thought about transferring that responsibility to the frontend (React). I mean, return the opendid details to the frontend and do checking in the API (GET user, if not user POST user).Is that a good or recommendable approach?
Submitted October 31, 2019 at 12:18PM by pmontp19
Submitted October 31, 2019 at 12:18PM by pmontp19
I’ve spent recent years coding with Node.js ... but recently I decided to explore Elixir - Check out my story
https://selleo.com/blog/elixir-for-nodejs-developers-your-handbook-to-success
Submitted October 31, 2019 at 12:26PM by tomaszbak
Submitted October 31, 2019 at 12:26PM by tomaszbak
GraphQL Questions (Prisma2)
Hi All,I've been looking into graphQL, particularly Prisma2 and have a few questions. I'm trying to get my head around the overall architecture, it's quite different to what I've worked with before (JSON APIs)[1] Business LogicIn a JSON API, I'd create an API endpoint to allow a user to sign up (this might kick off some async tasks and e.g. send an email).It seems like in graphQL architectures, mutations are used to provide the equivalent of an API endpoint, where business logic would be implemented (e.g. user sign up). Is this correct?I'm trying to understand how a system would be implemented without using express to provide API endpoints that would implement business logic and make calls to the graphQL layer via e.g. PhotonJS.[2] PhotonI understand that photon is a generated library to allow you easy access to your graphQL interface, but is this really only intended for usage on the server? Can this be exported to be used in e.g. an Angular 2+ project?It also seems that the generated photon client doesn't include mutations, so I'm a bit confused as to what the intent is with it.Any input would be useful :)Thank you!
Submitted October 31, 2019 at 11:55AM by seventai
Submitted October 31, 2019 at 11:55AM by seventai
Does Node cache/memoize function calls?
Long story short-ish: I have a Node project, part of which exposes an endpoint to get a list of timezones with their UTC offsets at that precise moment. In the UK (where we're based), before 01:00 UTC on 27 October (when the UK leaves British Summer Time), the endpoint should return '(GMT+01:00) London', and after, it should return '(GMT+00:00) London'.The problem is that if I start the process before 01:00Z 27/10 and then call the endpoint after, it still returns '(GMT+01:00) London'. I simulate this by manually changing the system time.The data is generated by a function call that calls a formatting library that wraps Moment Timezone to generate the data. IIRC, unless its overridden, Moment will assume that the time you want is the current system time. So why, when I hit the endpoint after 01:00Z 27/10, does it behave as though it's before 01:00Z 27/10?A possibly related tangent: I inserted a console.log() in the function call to check the arguments and default values. I expect it to output whenever I hit the endpoint. In reality, it outputs to console five times as soon as I start the process, and then never again, no matter how many times I hit the endpoint.So the question is: is Node implicitly memoizing this function call, somehow?I understand this is an odd one, but if anyone has any experience of this or something like this, I'd be interested to know!
Submitted October 31, 2019 at 11:24AM by jl3b
Submitted October 31, 2019 at 11:24AM by jl3b
Hands-on guide: developing and deploying Node.js apps in Kubernetes
https://learnk8s.io/nodejs-kubernetes-guide/
Submitted October 31, 2019 at 10:31AM by danielepolencic
Submitted October 31, 2019 at 10:31AM by danielepolencic
I've written my first tutorial. How to make a twitter bot with node.js (It's a twitter bot that helps people quit twitter)
I'd really love some feedback as I'm planning on writing a bunch more.Here's the tutorialhttps://beautifuldingbats.com/how-to-make-a-twitter-botHere's the repo, feel free to use it to make your own twitter bot. (it's so easy)https://github.com/ShadowfaxRodeo/qwitter-botLet me know what you think!
Submitted October 31, 2019 at 09:52AM by RespectableCafe
Submitted October 31, 2019 at 09:52AM by RespectableCafe
How to Secure Node js Rest API with JWT
https://www.codespot.org/how-to-secure-nodejs-rest-api-with-jwt/
Submitted October 31, 2019 at 08:33AM by Aleksandar_V
Submitted October 31, 2019 at 08:33AM by Aleksandar_V
Real-time crypto markets tick data via Node.js and without callbacks
https://github.com/tardis-dev/tardis-node
Submitted October 31, 2019 at 08:30AM by Tardis_Thad
Submitted October 31, 2019 at 08:30AM by Tardis_Thad
Wednesday, 30 October 2019
Any good example of a Node.js application that looks like something you would find in a production environment?
After completing a bunch of tutorials, I thought everyone used Mongoose on their backend to make life easier, but I've seen people use their own database/ODM implementation and I've learned it the hard way, because I completely failed a test I was given after a very successful interview, so I want to see some examples on GitHub of how production-grade Node.js applications are implemented. Thanks.
Submitted October 31, 2019 at 01:19AM by jesusscript
Submitted October 31, 2019 at 01:19AM by jesusscript
[Help] Unable to install latest nodejs in Ubuntu
I have run sudo apt-get update to check for updates. But I can only get a v8 nodejs by command sudo apt-get install nodejs. The Ubuntu reports it is already the latest version. Any solution for that?
Submitted October 30, 2019 at 11:39PM by fanju45
Submitted October 30, 2019 at 11:39PM by fanju45
N-API and Default Node Api methods
Hey everyone,I’m getting started with N-API to produce some native addons for my Electron apps, so apologies if this is very basic stuff.I’ve been able to write/build some simple examples to learn the basics, but how would one go about accessing the filesystem and doing crypto operations in the native c/c++ code? (Functionality that one might just utilise for “node licensing” and authentication)I had assumed that Node would allow me to import native headers for things like fs and crypto (similar to how I’d require() then in JS) but I can’t find any definitive answers or more advanced examples that cover this functionality in a way I can follow.I’ve seen some references to libsodium online for crypto but is it really necessary to be adding third party libraries for this?Thanks all, hope to hear from you soon 🙂
Submitted October 30, 2019 at 11:49PM by rs2845
Submitted October 30, 2019 at 11:49PM by rs2845
Good Refresher Book recommendation
Hello all,I recently wanted to get back into full stack web development again. Its been a little while since I did any web development, and just wanted a good refresher and skill building book for full stack specifically with Node. Any advice would be very helpful.Thanks,
Submitted October 30, 2019 at 11:59PM by Devastation1414
Submitted October 30, 2019 at 11:59PM by Devastation1414
Any good example of a node.js application that looks like something you would find in a production environment?
After completing a bunch of tutorials, I thought everyone used Mongoose in their backend to make life easier, but I've seen people use their own database/ODM implementation and I've learned it the hard way, because I completely failed a test they gave me, so I want to see some example on GitHub of how production-grade Node.js applications are implemented. Thanks.
Submitted October 31, 2019 at 01:06AM by jesusscript
Submitted October 31, 2019 at 01:06AM by jesusscript
How did you start?
Im a computer science student and I have little to no coding experience prior to college. I’m doing well in my courses, but I feel as though I’d be useless to an employee and I can’t make anything serious. Sure I can make tic tac toe games in the command line but I feel like I can’t actually make a THING. I want to create something that I can interact with, and learn something that is used in industry.After research and asking around the MERN stack came up a lot, and feels like a good place to start.I was wondering if anyone here would like to share what their first side projects were, any resources you found to be the most beneficial and any tips and advice for how to get started on becoming useful.
Submitted October 30, 2019 at 06:14PM by zacharymayers
Submitted October 30, 2019 at 06:14PM by zacharymayers
Developing command-line tools with Node.js
https://www.hacksparrow.com/nodejs/developing-command-line-tools.html
Submitted October 30, 2019 at 06:39PM by hacksparrow
Submitted October 30, 2019 at 06:39PM by hacksparrow
[Help] I am very confused. Need some help to start.
I'm fairly new to the world of Node.js and I have some questions because I am greatly confused.I did a project via Online Courses in Udemyhttps://yelpcamp-web-coders.herokuapp.comWhat got me confused, is that I read blog posts, did a number of google searches, and I found billions of courses, books, blog posts, technologies and this is where I am really greatly confused and I really need to sort them on my head.The only solution for me right is to create something on my own without any other courses, I really got tired.Doing courses and homework is easy, for example: write a sort function, make some classes or objects, sort by age, create some eventListeners and so on. But what happens when you want to make a Full Stack Web App? And that's exa ctly where I'm stuck.In the above project which was created on May, that project used Javascript 5 but that's ok. I learned a little bit of Node.js, npm, view engines and somehow managed to do it.For starting I would like to write/create my own blog.I know I can create a blog with Static HTML/CSS/Javascript and some JSON files but I want to do something more complex like for example, when I or the user visits the following url:/blog/posts // Select only the Title and a Short Description from the Table Posts/blog/posts/post_id // Select all from the selected titleMy goal is to use 2 tables, the 1st will contain only id, post_title and the 2nd will contain the post, date_created, primary_id, foreign_key (id from the 1st table) and will make them appear on my browser will relationships and I will also add comments from users via a different table. I'm sure with this I will be able to handle some databases to make my beginning.Now, these are my problems:Is node.js good for MySQL or PostgreSQL?Which Template Engine should I use? I searched and I found many people mention Handlebars, pug, ejs. As I mentioned I want to be able to pull data from a database and make it appear to the user. What is the best to be used with FrontEnd, I want for example something like:
Where and will get them from the Database, also I would like to learn Angular and ReactJS in the future, How can I render my webpages with ReactJS or Angular, do I have to use a template engine like ejs and combine ejs with React or is there any different way?3) Should I learn webpack? I read webpack's description if I understand correctly, if for example I have billions of CSS and JS files, webpack combine all of them and serve only 1 CSS and 1 JS file to the end user, is that correct?4) Should I learn Docker?I have 3 PCs, A desktop with Windows, A laptop with Ubuntu and VPS with Ubuntu Server, if I have understood correctly, with Docker you create a container, throw your app, nginx, MySQL server and with a command you are done.I know how to create services, install apps on Linux and I think it might be a lifesaver if I want to change VPS and for testing purposes to all of my machines (I think so)
Submitted October 30, 2019 at 05:51PM by MariosFFX
Submitted October 30, 2019 at 05:51PM by MariosFFX
Is there a way to compress an image buffer?
Is there an npm dependency or some example online on how to compress an uploaded image? I can even lose quality I don't really care!
Submitted October 30, 2019 at 04:59PM by Vanny96
Submitted October 30, 2019 at 04:59PM by Vanny96
Send JWT and redirect to another page in a single step ?
I'm using express.js to build a website. Everytime a user logs in, I generate a JWT, which is use to authorize all further activities the user does. For this I must receive the jwt as a request header, which means the user must have access to it through the frontend, so every generated jwt (after each successful login) must be sent back to the user.The problem is, I want the user to also automatically be redirected to the home page, something which requires use of res.render or res.redirect. how can I make sure the user gets back the jwt after logging in and then also gets redirected to another pageP.S. I've tried adding the jwt token as part of the header for redirect but that has not worked, the user simple gets redirected to the home page, but I can't see the jwt arriving in the headers when I test it on postman.Also, methods like appending the jwt as a search term in the res.redirect URL are also not an option, because the Auth is not a one time thing, I need the frontend to have access to the jwt for all further requests to get authenticatedI know cookies is a solution, but I'm hoping for a something cleaner that that, because there's a chance I may be redirecting the user across two different daomains at one point, in which case I don't think cookie would be a viable solution anymoreAny help is appreciated, thanks is advance !
Submitted October 30, 2019 at 05:25PM by Bowserwolf1
Submitted October 30, 2019 at 05:25PM by Bowserwolf1
Ultimate Guide On How To Use Class In Javascript
https://codesquery.com/javascript-class-es6-feature/
Submitted October 30, 2019 at 04:26PM by hisachincq
Submitted October 30, 2019 at 04:26PM by hisachincq
Native GraphQL Boilerplate for DGraph
https://github.com/graphql-editor/graphql-backend-template-dgraph
Submitted October 30, 2019 at 03:45PM by ArturCzemiel
Submitted October 30, 2019 at 03:45PM by ArturCzemiel
Why should you use TypeScript?
https://www.youtube.com/watch?v=hMef3qxDfJ8
Submitted October 30, 2019 at 03:54PM by hiquest
Submitted October 30, 2019 at 03:54PM by hiquest
Ghost 3.0 with Gatsby/GraphQL
https://blog.graphqleditor.com/ghost-gatsby-graphql/
Submitted October 30, 2019 at 03:50PM by oczekkk
Submitted October 30, 2019 at 03:50PM by oczekkk
Aeternity: Bitcoin-NG the way it was meant to be
https://medium.com/aeternity-crypto-foundation/aeternity-bitcoin-ng-the-way-it-was-meant-to-be-df7bb1d65a4b
Submitted October 30, 2019 at 01:31PM by aetrnty
Submitted October 30, 2019 at 01:31PM by aetrnty
Node.js Development - FAQ
https://hi.monterail.co/324IG12
Submitted October 30, 2019 at 11:54AM by estatarde
Submitted October 30, 2019 at 11:54AM by estatarde
Spruce - open source social networking platform keeping your privacy in mind 😃
https://github.com/dan-divy/sruce
Submitted October 30, 2019 at 11:36AM by undefined_void
Submitted October 30, 2019 at 11:36AM by undefined_void
How do I send welcome email 5mins later after user registration?
I was googling about this and confused by task/job scheduler and queue? What is the difference?I found node-cron, agenda and bull packages.Which one best fits for the sending welcome email?My stack: Apollo-express, TypeScript, Postgres, Redis (for apollo-cache).
Submitted October 30, 2019 at 11:37AM by xzenuu
Submitted October 30, 2019 at 11:37AM by xzenuu
Why errors on timers are not caught?
https://i.redd.it/mn1dslv4pnv31.png
Submitted October 30, 2019 at 10:34AM by yonatannn
Submitted October 30, 2019 at 10:34AM by yonatannn
Technical Debt - What Is It And How To Deal With It | Software Brothers Blog
https://i.redd.it/8xlzxo1lwhv31.jpg
Submitted October 30, 2019 at 08:39AM by SoftwareBrothers
Submitted October 30, 2019 at 08:39AM by SoftwareBrothers
Unable to send response to front end using express router
I have a route like this -router.post('/fetch', common.fetch, function(req,res,next){util.log("Sending the response to frontend");return res.send(res.message);})This is being called via front end, I do some data manipulation in common.fetch function. Last few lines of my common.fetch are like this -common.fetch = function(req,res,next){util.log("API Call succesful");util.log("Parsed received data from API");message.data = parsedBody.data;util.log("Attached received data to body");res.message = message;util.log("Sending response to next()");return next();}All logs are being printed so there is no problem in fetch function but Sending the response to frontend log is not getting printed. I am not sure why. This route is throwing 500. I am out of every way to debug this. Any help would be appreciated.
Submitted October 30, 2019 at 07:29AM by GhostFoxGod
Submitted October 30, 2019 at 07:29AM by GhostFoxGod
Nodemailer es7 async/await
Hallo everyone i just want to ask if there is a good tuorial pr teach me how to work nodemailer into asyn c/await. Thank you.
Submitted October 30, 2019 at 06:38AM by jochii
Submitted October 30, 2019 at 06:38AM by jochii
Tuesday, 29 October 2019
[Question] REST API Routes and Role Protection
I have a question about API routes and roles. Assuming a "simple" microservice architecture.So let's say there's a User role and a Admin role. Each have their own client frontend.The user can create a /POST /api/posts/create. However, the user can only have access to certain features when creating that post. Then, let's say the user wants to have access to a certain feature in /api/posts/create, BUT this is for Admin roles only. So the Admin decides to login to their own Admin account, and create the post for the User (so the admin is creating the post on the User's behalf).In a typical REST API (shown by most internet tutorials), it would be something like saying....Routes File:router.post('/api/posts/create', [isAuthenticated, isAuthorized], myController.createPost);Controller File:createPost: function (req, res) { var newPost = new Post(); newPost.title = req.body.title //etc. newPost.save(); //Saved to DB } So, because Admin has access to certain fields (or the "right" to do something extra) on the same route (again, assuming microservice), does this mean I would have to do some kind of switch statement or conditional statement within the createPost() and have somewhat of a duplicate lines of code or am I supposed to make a new function specifically just for Admin level account users to access or something else? Because if I were to code createPost with the limits of User, then if Admin access the same route, the Admin is limited by the same things as the User. However, if I coded it for Admin, then User can perform just as much creation as the Admin on the same route....
Submitted October 30, 2019 at 12:32AM by nathangonz17
Submitted October 30, 2019 at 12:32AM by nathangonz17
Newb node dev (mac) nervous about installing nvm
What I have: mac OS 10.14 (Mojave). Current node version 10.14.I'm about to take the plunge and install nvm. But the more I read, the more nervous I get. Any mac users want to reassure or warn me about installing nvm?I read somewhere that it's "recommended" to uninstall node when installing nvm. But I haven't seen such an instruction in the NVM Github repository.Also, the nvm install instructions make me a bit queasy. It says don't use homebrew. Ok, fine. But I don't understand Xcode at all. There seem to be some gotchas with an install on mac.Any tips appreciated.
Submitted October 29, 2019 at 09:17PM by threadofhope
Submitted October 29, 2019 at 09:17PM by threadofhope
scraprr.xyz - a web scraping api
I made an http api to scrape webpages and get html elements as json. Check it out here. Any suggestions?
Submitted October 29, 2019 at 09:27PM by ammarbinfaisal
Submitted October 29, 2019 at 09:27PM by ammarbinfaisal
Build secure Node.js RESTful API using JWT Authentication
https://codesquery.com/build-secure-nodejs-rest-api-using-json-web-token/
Submitted October 29, 2019 at 07:18PM by hisachincq
Submitted October 29, 2019 at 07:18PM by hisachincq
Mongoose as your primary schema
In most articles related to Mongoose, Mongoose schemas seem to be the Primary schema. This seems to me like a mistake. The schema definition is coupled with Mongoose and Mongoose is written in NodeJS. In my humble opinion, the ideal Primary schema definition should be portable and use a well-known standard that crosses the boundaries of programming languages and networks. REST API using Hypermedia can use this schema to share metadata of return resources. Mongoose does schema do not fit this requirement. Instead, a mongoose schema should be derived from the Primary Schema. A good candidate is JSON Schema. However, I noticed a reduction in mention of JSON Schema in Google searches. Anyone using JSON Schema? What challenges you faced with while using it?
Submitted October 29, 2019 at 07:33PM by faboulaws
Submitted October 29, 2019 at 07:33PM by faboulaws
Stripe Integration - How Much of a Pain Is It?
Hey everyone,Starting to work on an idea for a SaaS company and I'm wondering from your experience how much of a pain it is to set up stripe integrations and payment plans on your site? Wondering if there are any worthwhile solutions to consider.Thanks!Patrick
Submitted October 29, 2019 at 05:29PM by pdufresn
Submitted October 29, 2019 at 05:29PM by pdufresn
I have been working on building Vault as a Service (an online service for storing passwords, keys, certificates, tokens and really anything that’s supposed to be secret). I'm about to release it and looking for early adopters. More details inside
I moved to application security from software development and we’re (including myself) all guilty of storing passwords, secrets, credentials in source control. Storing sensitive data in source control exposes it to everyone in your team, including contractors and temp developers. In addition, sometimes we make our repositories public and forget (we’re all humans at the end of the day) about the credentials we store in code, hence exposing our credentials to everyone.Attackers search GitHub for tokens & sensitive information, and it’s one of the most common ways of stealing credentials.Some teams use .gitignore to exclude credentials however this creates new challenges such as distributing all keys among team members, etc.We have been storing credentials in our source code not because we don’t know any better, but because there hasn’t been really a good service for us to use.I know the first concern you have is why on earth do I trust you with my most sensitive information? We use public/private key encryption, hence don’t even know what you store in your vault. It’s encrypted with your public key, and only you (as the private key owner) can decrypt it. This is similar to how password managers, such as 1Password and LastPass work.There’re other vaults available, but in order to use them, you still need to be familiar with security concepts, and they’re too complicated. Some of them won’t even let you use them, unless you engage with their stupid, sales team. Seriously?I’ve been working on building Vault as a Service for the past 2 years, and below are some of the features we already have:Easy to use, simple UIWe wanted to build something that’s beautiful, and super easy to use, hence our service comes with a simple, beautiful user interface. Security doesn't mean the UI supposed to be ugly!No sales team.You don’t (ever) need to talk to our sales team. We actually don’t have one. It’s free for all open-source projects.Key RotationEasy to change keys without ever making any changes in your source code, or deploying anything.Auto Key ExpirationSometimes we want keys that will be available for a short amount time. Or if there’s a key that’s not being used by any application for over X amount of time, we can automatically invalidate it. Attackers look for legacy systems initially, because these are the systems no one cares about. So if there’s a legacy application that’s no longer in use, we can automatically disable the keys for it.Key GenerationGenerating a secure key is not a trivial task. Our vault handles this for you, by simply asking “give me a secure key”.Detailed Audit LogsRemote Access ACLYou can make your vault accessible by only certain IP addresses which increases security. Even if someone steals your master key, they won’t be able to access your vault.Encryption as a ServiceEncrypting data is also not trivial, what key size to use? AES or RSA? Just ask your vault to encrypt your data securely, using industry standards! That easy.Namespaces / Multi ProjectsCreate/Manage vaults per project, namespace or application. Use different keys for your development, staging and production environments.Would you be interested in using it in your project? If so, please comment below and I’ll get in touch. Thank you!
Submitted October 29, 2019 at 03:59PM by redditchapter709
Submitted October 29, 2019 at 03:59PM by redditchapter709
format-graphql: Format GraphQL schema definition language (SDL) document.
https://github.com/gajus/format-graphql
Submitted October 29, 2019 at 03:04PM by gajus0
Submitted October 29, 2019 at 03:04PM by gajus0
Basic Web Scraping With Puppeteer - JavaScript Web Scraping Guy
https://javascriptwebscrapingguy.com/jordan-scrapes-with-puppeteer/
Submitted October 29, 2019 at 03:08PM by Aarmora
Submitted October 29, 2019 at 03:08PM by Aarmora
Node.js MVC Boilerplate with Repository Design Pattern.
https://github.com/puncoz-official/nodejs-express-mvcSimple node.js architecture written in ES6+ using babel for class/object. I also tried to implement the Repository design pattern and Transformer/Presenter layer for API response. The suggestions are highly appreciated.
Submitted October 29, 2019 at 12:15PM by puncoz
Submitted October 29, 2019 at 12:15PM by puncoz
7 Methods for Working With Directories in Pure NodeJS
https://coderrocketfuel.com/article/7-methods-for-working-with-directories-in-node-js
Submitted October 29, 2019 at 10:57AM by jkkill
Submitted October 29, 2019 at 10:57AM by jkkill
My experience with node and best practices in one repo
You can find the repository here https://github.com/feredean/node-api-starterOver the past several years of working as a full-stack developer, I realized that very often I find myself taking a peek at past projects to refresh my memory when it comes to structure, various project configuration or implementation. After taking a look at popular projects like https://github.com/sahat/hackathon-starter or https://github.com/microsoft/TypeScript-Node-Starter I realized that they are not quite what I'm looking for. What I wanted was an API designed for app consumption. With this in mind and the projects mentioned above as a guide I started working on yet another node API starter (along with it's own example app!). When I started I had the following things in mind:fully configured development environmentuse async/await over callbackscreate integration tests with over 80% code coveragesupport CI and CDact as a repository of "examples" as well as a starter kit for creating applicationsAt this point, I have more or less achieved what I have set out to do and decided it's time to reach out to the community in order to get some feedback.
Submitted October 29, 2019 at 10:24AM by tbfrdn
Submitted October 29, 2019 at 10:24AM by tbfrdn
Using npm-link for package development
https://terodox.tech/using-npm-link-for-package-development/
Submitted October 29, 2019 at 09:41AM by dobkin-1970
Submitted October 29, 2019 at 09:41AM by dobkin-1970
I wonder why nobody made it before, so I made it myself. You can download bigger image from my github repo and print it. (Btw. I created also "The Nodemother" version also).
https://i.redd.it/z6uin0m0ufv31.png
Submitted October 29, 2019 at 08:09AM by hadibeendrinkin
Submitted October 29, 2019 at 08:09AM by hadibeendrinkin
Monday, 28 October 2019
Node development best practices?
Any courses and/or books that you recommend? It seems that there should be accepted practices for doing common things like ingesting config files, logging, error handling, etc. I'd like to see how other people handle these sorts of foundation tasks when designing a project.
Submitted October 29, 2019 at 04:10AM by mattzees
Submitted October 29, 2019 at 04:10AM by mattzees
Node, Express, SQL (Postgres) Quickstart
I made a Node API quick-start/example application. Any feedback or suggestions would be greatly appreciated. Thanks all!GitHub: https://github.com/austynherman112994/node-quick-start/tree/master/node-express-psql.
Submitted October 29, 2019 at 01:19AM by ANH11
Submitted October 29, 2019 at 01:19AM by ANH11
Building awaitable and fluent interfaces in Javascript
https://evertpot.com/await-fluent-interfaces/
Submitted October 28, 2019 at 11:47PM by evertrooftop
Submitted October 28, 2019 at 11:47PM by evertrooftop
Keep .env in sync with teammates on Slack
https://github.com/codeshifu/sync-dotenv-slack
Submitted October 29, 2019 at 12:43AM by codeshifu
Submitted October 29, 2019 at 12:43AM by codeshifu
Has anyone tried Sifrr?
I've used express and it's a default for most of my projects. I wanted to know some really good alternatives with a little more priority on speed. I came across Sifrr which happens to be really fast (on benchmarks at least). Have any of you guys tried it for real projects?P.S.: No, I don't have Shiny Syndrome.
Submitted October 28, 2019 at 08:08PM by ParadoxicalUser
Submitted October 28, 2019 at 08:08PM by ParadoxicalUser
HTTP requests from React not reaching Express backend on production server
Hello, I am new to Node and React development and in desperate need of some help. I have a backend and frontend that are able to communicate when I run both locally, but I can't seem to get them to talk to each other on my production server (on a shared Apache server with SSH access). Details here: https://stackoverflow.com/q/58567160/6647072. Any leads hugely appreciated. Thanks!
Submitted October 28, 2019 at 08:38PM by leafy212
Submitted October 28, 2019 at 08:38PM by leafy212
Project ideas for node and react
anyone please suggest me some intermediate level project ideas suitable for node except social networking and chat app. i would use react for frontend...thank you
Submitted October 28, 2019 at 03:46PM by Sakib_Shahriar
Submitted October 28, 2019 at 03:46PM by Sakib_Shahriar
Stripe with Node.js: Best Practices and Interactive Examples
https://blog.servicebot.io/stripe-and-node-js-best-practices-and-examples/
Submitted October 28, 2019 at 02:53PM by FkGhost
Submitted October 28, 2019 at 02:53PM by FkGhost
Persisting draggable cards sort order
I'm wondering if there are some alternative approach when saving the sort order of draggable cards in a list.My approach is when a card has been drop to a list then make a call to API sending all card_id and sort order. I think this approach may work but it would required multiple db calls like updating sort order for each card_id which I think is not good.
Submitted October 28, 2019 at 02:15PM by jhefreyzz
Submitted October 28, 2019 at 02:15PM by jhefreyzz
Docker and Node.js Best Practices from Bret Fisher at DockerCon
https://www.youtube.com/watch?v=Zgx0o8QjJk4
Submitted October 28, 2019 at 12:57PM by dobkin-1970
Submitted October 28, 2019 at 12:57PM by dobkin-1970
Terminal based 3D graphics in ASCII art. Implemented in Javascript
https://github.com/sinclairzx81/zero
Submitted October 28, 2019 at 12:33PM by tknew
Submitted October 28, 2019 at 12:33PM by tknew
Running node load on App engine vs VM (google )?
Which one are you guys prefer on running nodejs? App engine or VM instance? Please do comment on your reason too.
Submitted October 28, 2019 at 11:50AM by sujesht
Submitted October 28, 2019 at 11:50AM by sujesht
How to prepare for Junior Node Developer Interview
Hello guys, This is my first thread to the channel. The reason I am writing is that I want to know what type of questions are being asked at the beginner level jobs of a Node.js developer. Also, I know only basic CRUD implementations in node, also node mailer, login and signup, and the password forget functionality. Is that enough to clear an entry-level Node.js interview session?Can anyone suggest me good free Node.js learning tutorials
Submitted October 28, 2019 at 12:00PM by SMammar110
Submitted October 28, 2019 at 12:00PM by SMammar110
Alternatives to Loopback 3?
Hi all,I've built a few projects with Loopback 3, which although I love the idea, seems to fall short in a few places. Loopback 4 may solve some of these issues, but it doesn't have feature parity with 3 yet, so I'm looking at alternatives.Things I like about LB3:- Built in user/roles/authentication (massively helpful to have this built in)- Can generate an angular 2+ library for the front end to access all APIs and objects- ORMProblems- Documentation (lack of/confusing in places)- Some stuff missing from ORM- A lot of issues getting intellisense to work in VS code!Any suggestions of node frameworks that could provide the above, ideally with typescript? Having users/roles/auth out of the box is a big one for me as I do a lot of proof of concept projects, as is the ability to generate an angular 2+ library for my front end. Ideally built around express and strong ORM like sequelize.Any suggestions?Thanks!
Submitted October 28, 2019 at 10:36AM by seventai
Submitted October 28, 2019 at 10:36AM by seventai
Functional Library
Hello,I'm creating a functional library.because the popular libraries do not support Promise.have fixed anything or needed additional features?i'd like to know something can be refactored downhttps://github.com/rudty/nodekell
Submitted October 28, 2019 at 09:33AM by rudtyz
Submitted October 28, 2019 at 09:33AM by rudtyz
Anyone using npm ci command?
How do you install a new package using this command?npm install --save modifies package-lock.json
Submitted October 28, 2019 at 07:35AM by devitaebrae
Submitted October 28, 2019 at 07:35AM by devitaebrae
How to Build Rest API with Node js and Express js
https://www.codespot.org/how-to-build-rest-api-with-nodejs-and-expressjs/
Submitted October 28, 2019 at 06:48AM by Aleksandar_V
Submitted October 28, 2019 at 06:48AM by Aleksandar_V
Sunday, 27 October 2019
Best books to learn nodeJS?
No text found
Submitted October 28, 2019 at 02:07AM by something123454321
Submitted October 28, 2019 at 02:07AM by something123454321
Can you connect an android and a PC over LAN using the device name?
I've been messing around with Node JS in my free time and I've got an android app that connects to a server on my PC using http://pc-ip:port. At work we can connect to each others PC's using http://pc-name:port, but I'm guessing that's something to do with how the network is configured, as I can't connect a client to a server using device name when I'm at home. Is what I want even possible?
Submitted October 27, 2019 at 11:41PM by TOPHATANT123
Submitted October 27, 2019 at 11:41PM by TOPHATANT123
Containerizing a Node.js API & Using Docker with Kubernetes and Minikube
https://hackernoon.com/containerizing-a-node-js-api-using-docker-with-kubernetes-and-minikube-30255fd33ef9
Submitted October 27, 2019 at 05:49PM by pmz
Submitted October 27, 2019 at 05:49PM by pmz
Learn to Cache your NodeJS Application with Redis in 6 Minutes!
https://medium.com/@abdamin/learn-to-cache-your-nodejs-application-with-redis-in-6-minutes-745a574a9739?source=friends_link&sk=9ecbc528e609b9198ef692e609c9ae6c
Submitted October 27, 2019 at 05:11PM by kiarash-irandoust
Submitted October 27, 2019 at 05:11PM by kiarash-irandoust
Any beginners wanna do paired programming and work on a project?
We can dedicate an hour a day or so and work on a cool little website, LMK if your down, beginners preferred as I won’t be able to keep up with intermediate people 😅
Submitted October 27, 2019 at 03:50PM by flat_soda_club
Submitted October 27, 2019 at 03:50PM by flat_soda_club
npm sqlite3 install wtf
npm install sqlite3 then watch your console output. I thought this was banned by npm? I can't tell where it's coming from, seems to be in the dependency chain.
Submitted October 27, 2019 at 02:51PM by FearAndLawyering
Submitted October 27, 2019 at 02:51PM by FearAndLawyering
Has anyone taken this course https://pirple.thinkific.com/courses/the-saas-master-class?
Hi fellow reddittors. Has anyone taken this course https://pirple.thinkific.com/courses/the-saas-master-class. If yes, please can you share the review?
Submitted October 27, 2019 at 11:21AM by shivarajapple
Submitted October 27, 2019 at 11:21AM by shivarajapple
Building A Node.js Express API To Convert Markdown To HTML
https://www.smashingmagazine.com/2019/04/nodejs-express-api-markdown-html/
Submitted October 27, 2019 at 09:11AM by dobkin-1970
Submitted October 27, 2019 at 09:11AM by dobkin-1970
Asking about node application production and development
Hi! I am a beginner in Node.js, I would like to ask is there any tutorial from scratch (from zero) about managing for production release and development in one codebase?Let's say I have a project with simple API Service using Express and MongoDB;>const express = require('express');>const app = express();>const PORT = 3000;>app.get('/', (req, res) =>{ res.json({success: true, data: "It's work"});});>app.listen(PORT, ()=>{console.log(`API run at PORT ${PORT}`)});How to implement production and development from those codes?Any answer will be greatly appreciated since I am still learning this platform, thank you.*edit: formatting
Submitted October 27, 2019 at 09:08AM by geol88
Submitted October 27, 2019 at 09:08AM by geol88
Saturday, 26 October 2019
Halp I dont know how to fix this. This is on raspberry pi.
https://i.redd.it/51peer9b60v31.jpg
Submitted October 27, 2019 at 03:28AM by WeekendKingdomYT
Submitted October 27, 2019 at 03:28AM by WeekendKingdomYT
Recommendation Engine
I am trying to build a recommendation engine that uses LIKES to recommend stuffGuest user FOLLOWS ITEM1The engine will look return recommendations based on what other ITEMS all users in the system that FOLLOW ITEM1The API will return those recommendationsI cannot seem to find any open library for this.I tried to use Raccoon library for this: https://github.com/guymorita/recommendationRaccoonbut it is not behaving how I expected.Any feedback on this will be greatly appreciated. Thank you.
Submitted October 27, 2019 at 04:17AM by enigmatic5000
Submitted October 27, 2019 at 04:17AM by enigmatic5000
Joe's Useless Mac Utilities: syntax-clip
syntax-clip will syntax highlight code in your clipboard, and replace it with rich HTML you can paste into an e-mail, doc, etc.https://github.com/jhuckaby/syntax-clipI realized after making this tool that Visual Studio Code does this natively! Gah!!! So yeah, pretty useless. But hey, maybe someone can use the code to build something useful. 🤷🏻♂️
Submitted October 27, 2019 at 02:08AM by cgijoe_jhuckaby
Submitted October 27, 2019 at 02:08AM by cgijoe_jhuckaby
Joe's Useless Mac Utilities: clipdown
clipdown will convert rich HTML to Markdown source in your clipboard. Could be useful for bloggers, who need to quote an article or portion of a web page. Using this they can copy the content, activate clipdown, and then paste into their Markdown editor. It converts formatting (styling), links, lists, and tables.https://github.com/jhuckaby/clipdown
Submitted October 27, 2019 at 02:17AM by cgijoe_jhuckaby
Submitted October 27, 2019 at 02:17AM by cgijoe_jhuckaby
How can I reduce the boilerplate for my UI projects? (Webpack+Pug+SCSS/LESS+...)
When I need to write a GUI for my node projects I like to stay vanilla instead of using big web framework.Usually I define the DOM using Jade or Pug, manipulate it using the standard browser JS API and tweak the style with SCSS or LESS.I then pack everything together (including node code and libraries) using Webpack.I'm a bit bothered by the amount of boilerplate that goes into every project with an UI though. In fact I always end up with:Many many extra dependencies (e.g. css-loader, node-sass, sass-loader, style-loader, pug, pug-loader, html-webpack-plugin, copy-webpack-plugin, to-string-loader, webpack, webpack-cli, webpack-dev-server and usually more).A 50+ lines webpack.config.js.Several NPM scripts in my package.json to start, build or test the web assets.Normally I copy and paste all this stuff from previous project and only modify what's needed. That takes several minutes, feels very repetitive, the package.json becomes all cluttered and I hate how much code is duplicated between my various UI projects. This happens even with the tiniest UI projects, while it's rare with pure Node.Would anybody have any ideas on how to remove all this boilerplate?
Submitted October 26, 2019 at 11:43PM by RedditWideWeb
Submitted October 26, 2019 at 11:43PM by RedditWideWeb
Http request in node vs python
So I wrote a script in python using the requests module, and a script in node using the request module. Both scripts consists of a simple http.post request that returns an object. Now, the difference is that the object returned in python is different from the object returned in node. Very different, for example in python it returns the token Id, firstname, lastname; and in node it returns the url, version, headers, useless stuff.... I can’t seem to understand how this could be possible. So can please anyone help me?
Submitted October 26, 2019 at 11:43PM by wavedrop_
Submitted October 26, 2019 at 11:43PM by wavedrop_
Non-trivial projects for portfolio
What are some non-trivial projects I can build that would demonstrate a solid understanding of the Node ecosystem for a backend role? Or alternatively, are there any problems you’re having right now that you wish there was a package or library for?I’m building out my portfolio but it’s tough coming up with ideas that haven’t already been done and will stand out. I’d prefer not to go into an interview with only CRUD apps on my resume.Any help would be appreciated!
Submitted October 26, 2019 at 09:44PM by brodega
Submitted October 26, 2019 at 09:44PM by brodega
Creating a web app in node to host and deliver misc Excel Reports
Hey, what's up? At my work, we currently use a Grails/Groovy project to host a website where managers and other employees can log in and download reports and if they wish, subscribe to reports that are outputted into Excel. Outputting the raw data is easy enough, but sometimes we get report quests that pretty much simulate what Pivot Tables do in Excel. This is where it is currently tedious as we are grouping the raw data into hashmaps then outputting that data in a similar format using nested key:value pairs. We currently have to keep track of row indexes and column indexes and it can quickly become confusing.We are leaning toward using Node for the future and I was reading a little about excel4node and xlsx. My question is what do you guys think about moving toward Node and also if there is any library or framework I can use (maybe excel4node?) that could make pivot tables easier to handle and output. Sorry if this is confusing as I am pretty new to the project. Thanks.
Submitted October 26, 2019 at 08:37PM by shevaneltaketwo
Submitted October 26, 2019 at 08:37PM by shevaneltaketwo
Good Tutorial to Set Up Authentication?
Hi All, I'm wondering if anyone has a tutorial or code-along thing that they might recommend for someone looking to learn how to go about setting up user authentication using Node JS? I want to set something up that will let someone "log in" to a website using their username and password, or sign up if they don't have one yet. A "forgot password" option would be neat, too. Is there anything out there that someone could recommend? Preferably something that's free? Thanks in advance.
Submitted October 26, 2019 at 07:13PM by cryptoMadness5K
Submitted October 26, 2019 at 07:13PM by cryptoMadness5K
Looking for an indepth guide to expressjs
Hi! I want to learn expressjs in depth. What are the topics that I should cover? Are the docs a good place to start? What are the resources apart from the docs that I can look into?
Submitted October 26, 2019 at 03:36PM by lostavenger286
Submitted October 26, 2019 at 03:36PM by lostavenger286
Is this Express code sample actually a load balancer?
I've seen this code block on a handful of websites now regarding a very simple load balancer in Express. Does node handle each express instance in a separate thread under the hood? How is this code sample any different from two listeners operating in the same thread?From: https://medium.com/techintoo/load-balancing-node-js-51b854fb4f4f const body = require('body-parser'); const express = require('express'); const app1 = express(); const app2 = express(); // Parse the request body as JSON app1.use(body.json()); app2.use(body.json()); const handler = serverNum => (req, res) => { console.log(server ${serverNum}, req.method, req.url, req.body); res.send(Hello from server ${serverNum}!); }; // Only handle GET and POST requests app1.get('', handler(1)).post('', handler(1)); app2.get('', handler(2)).post('', handler(2)); app1.listen(3000); app2.listen(3001);
Submitted October 26, 2019 at 03:09PM by FullstackViking
Submitted October 26, 2019 at 03:09PM by FullstackViking
How do we build a node module, which allows separate imports?
Does anyone know how to add multiple separate packages in a node module?For eg.let auth = require("firebase/auth")let database = require("firebase/database")How do we structure such a node module, which allows separate imports?
Submitted October 26, 2019 at 12:13PM by vasa_develop
Submitted October 26, 2019 at 12:13PM by vasa_develop
Which projects should i make to pick my first job as a web developer?
No text found
Submitted October 26, 2019 at 12:01PM by mutedsomething
Submitted October 26, 2019 at 12:01PM by mutedsomething
This guy is a HERO! I worked for an hour before I found this helpful article.
https://spin.atomicobject.com/2019/03/27/node-gyp-windows/
Submitted October 26, 2019 at 11:09AM by BackPacker777
Submitted October 26, 2019 at 11:09AM by BackPacker777
Node vs. Python when working with Excel and other MS products for automation
I am currently learning VBA (I know JS already) to better my excel skills in the workplace. I really would like to also incorporate my JS skills with Excel and other MS products to allow for more complex automation.However, outside of VBA, it seems Python is the defacto language (things like Python Automate the Boring Stuff) when it comes to working with Excel automation.Is Node.js on par with Python to allow for the same level of automation, or is it best to use Python instead?
Submitted October 26, 2019 at 08:21AM by RSpringer242
Submitted October 26, 2019 at 08:21AM by RSpringer242
Friday, 25 October 2019
Can Node API built on top MySQL DB
Hi I know node APIS can be built on top of nosql DB can node API be built with MySQL db ? Please give me your ideas glad if anyone can share good resource
Submitted October 26, 2019 at 06:55AM by ucsraju
Submitted October 26, 2019 at 06:55AM by ucsraju
Learn React, JavaScript, Angular, Node from scratch...
https://www.tutorialslogic.com/javascript
Submitted October 26, 2019 at 07:14AM by ukmsoft
Submitted October 26, 2019 at 07:14AM by ukmsoft
I'm very interested in using API's for my projects but am always very lost in the documentation. Any resources would help.
Of the few API's I've tried, I spent around 3 hours just to get a 200 when I feel it should have taken 20 minutes. Are there any good resources for using third party API's with node and express?
Submitted October 26, 2019 at 04:06AM by crypto_thiccboy
Submitted October 26, 2019 at 04:06AM by crypto_thiccboy
Suggestions on how to overcome the challenges of Dynamic language
Sorry for the long title tried to make it as explanatory as possible.I am a long time C# programmer. I have never worked on any application run on HTTP protocol but have done many networked applications in past. Currently I have an client who offered a job to port their in-house surveying system's admin panel get ported to web. So basically I need to port an .NET2 application to the web and make that web application be compatible with their already existing authentication database and all that stuff etc etc.My problem is that even though I worked with sockets and networks in a very simplistic manner in C# I have never done ASP.NET yet alone HTTP. Now the first issue with this is that, client decided to port the application web because they have decided to not use any Windows Servers anymore. Lucky for me .Net Core supports ASP.Net but unlucky for me I hated every single thing about ASP.Net. I mean 'to me' it is disgusting... I asked them what languages would they want and client said that they want either C# with .Net Core, Django or Node.JS environment. Now c# is out of options, I hated ASP.NET. Django is... Meh in my opinion. It is a great framework but I dont like tab spacing dominating my code. I am more of a control paranoid and I want brackets. When I checked NodeJS I saw that it is a great runtime environment. It's syntax is clean and follows the same sexy principles of JavaScript. plus Node being async is just too good to pass even it only runs in single thread. It's such a powerful thing especially if you are writing an back-end which queries tons of stuff all the time.Here is where my ACTUAL BIG problem starts:It has been little bit more than a week and I am starting to step into serious issues here and there. At first, JS being a dynamic language gave me a whole new powers. I can manipulate things like I could never done before. At the beginning this is great but as the code gets bigger and bigger and bigger and biiiiggeeerrr this starts to become a issue. Especially if you have other people coding together with you. If you have ever worked with a team you know that following a strict style in your code is really important at big projects. This is true for everything I guess. The more crowded a community the more strict rules you need. This applies everywhere. The dynamic structure of JS really started to cause serious problems for me. My coworker is changing the variable type without knowing what it was before and suddenly the JavaScript engine tries to parse a string as if it is an integer because the parser I built was specific for integers.It is impossible for me to be the first person encountering these issues. I wanted to get the feedback of you all on how did you manage to overcome these issues. In a community discord that I am a member of I asked the same questions and people said that "TypeScript is a great solution for this but if you are writing back-end in Node TS might cause issues in your code."To me TypeScript not being able to work well with Node is not possible. It is supported by Microsoft. I dont believe it is true but I also dont want to risk it either. Can I get all of you people opinion on this?
Submitted October 26, 2019 at 01:47AM by FastFlyingTurtle
Submitted October 26, 2019 at 01:47AM by FastFlyingTurtle
What Can Be Done to Strengthen the Node.js Package Ecosystem?
Interview with Michael Dawson, IBM Node.js Community Lead at IBM and the Node.js community Board representative, OpenJS Board of Directors, to dig into key Node.js topics to find out the state of package quality, making developing Node containerised apps for the cloud easier, and what Node events, as a long time member of the Node community, are coming up that are best suited for people digging into these problems.
Submitted October 25, 2019 at 09:56PM by jcasman
Submitted October 25, 2019 at 09:56PM by jcasman
Query Nested Data in Postgres using Node.js
https://medium.com/@forbeslindesay/query-nested-data-in-postgres-using-node-js-35e985368ea4
Submitted October 25, 2019 at 04:31PM by ForbesLindesay
Submitted October 25, 2019 at 04:31PM by ForbesLindesay
Looking for good tutorials to Implement SAML 2.0 using NodeJS
Does anyone have any good tutorials or resources where I can learn how to implement SSO using SAML 2.0? I chanced upon passport.js(saml strategy) and saml2-js which can be used to implement SAML authentication. But would like to understand by building a demo application.
Submitted October 25, 2019 at 04:49PM by lostavenger286
Submitted October 25, 2019 at 04:49PM by lostavenger286
How do I use jsdom with a URL instead of a string containing HTML code?
On the jsdom npm package page, the following example is given:const dom = new JSDOM(`
Submitted October 25, 2019 at 03:51PM by Bifrons
Hello world
`); console.log(dom.window.document.querySelector("p").textContent); // "Hello world" Another example is given for using a URL instead of a string:const dom = new JSDOM(``, { url: "https://example.org/", referrer: "https://example.com/", contentType: "text/html", includeNodeLocations: true, storageQuota: 10000000 }); However, every other example seems to use the first example as a template instead of the second. Further, when I run console.log(dom) on the first example, I can see that dom contains data. However, when I run console.log(dom) on the second example (using an actual URL), dom is set to null.I'm having trouble finding guides on how to use this package, and the stuff I'm finding appear to be older, referencing jsdom.env and other things that the npm page I linked doesn't do. Could anyone tell me the correct way of using this package with a URL, or point me to a good guide or documentation for this package?Submitted October 25, 2019 at 03:51PM by Bifrons
[need suggestions] Scaffolding Admin panel for nodejs app/api
I have to build an application which will consist of around 60 models. Almost all them will require crud operations plus a lot of custom routes. I am worried about hand coding crud forms for this many models.So please recommend me some good framework or tools which can generate crud form and enable me to extend it seemlessly.Strapi.js? Prisma? appollo server? Sails.js? What is most suitable?
Submitted October 25, 2019 at 03:07PM by mubaidr
Submitted October 25, 2019 at 03:07PM by mubaidr
Sequelize unknown column in field list
Any help would be appreciated! I am still very new to Sequelize.I have recreated my MySQL Schema with sequelize migration and am getting this error... Anybody have any ideas? I thought it was a phantom column that I defined somewhere, but I looked pretty in-depth at my code and can't find it anywhere. (did a find within VScode on each file of my repository)https://i.redd.it/stlyygw9xou31.pngI do not have a column called UserPermId in my database and it will work if I add that column manually with MySQL workbench. I don't want that field! :DHere is a look at my model and migration:Model:'use strict'; module.exports = (sequelize, DataTypes) => { const UsersTable = sequelize.define('Users', { fn: { type: DataTypes.STRING(10), allowNull: false }, ln: { type: DataTypes.STRING(10), allowNull: false }, username: { type: DataTypes.STRING(20), allowNull: false, unique: true, }, password: { type: DataTypes.STRING(200), allowNull: false }, permgroup: { type: DataTypes.INTEGER(2) } }, { tableName: 'Users', freezeTableName: true }); UsersTable.associate = function(models) { // associations can be defined here UsersTable.hasMany(models.WorkOrders); UsersTable.hasMany(models.CartDrafts); UsersTable.belongsTo(models.UserPerms); }; return UsersTable; }; Migration:'use strict'; module.exports = { up: (queryInterface, Sequelize) => { return queryInterface.createTable('Users', { id: { allowNull: false, autoIncrement: true, primaryKey: true, type: Sequelize.INTEGER }, fn: { type: Sequelize.STRING(10), allowNull: false }, ln: { type: Sequelize.STRING(10), allowNull: false }, username: { type: Sequelize.STRING(20), allowNull: false, unique: true, }, password: { type: Sequelize.STRING(200), allowNull: false }, permgroup: { // todo type: Sequelize.INTEGER(2), references: { model: 'UserPerms', key: 'id' }, onUpdate: 'cascade', onDelete: 'cascade' }, createdAt: { allowNull: false, type: Sequelize.DATE }, updatedAt: { allowNull: false, type: Sequelize.DATE } }); }, down: (queryInterface, Sequelize) => { return queryInterface.dropTable('Users'); } }; The Database shows the correct fields and even the foreign key:https://i.redd.it/j1oawwvdyou31.png
Submitted October 25, 2019 at 02:44PM by Aberbob
Submitted October 25, 2019 at 02:44PM by Aberbob
GraphQL Interactive Tutorial for Beginners
https://app.graphqleditor.com/?category=tutorial&visibleMenu=code
Submitted October 25, 2019 at 02:55PM by ArturCzemiel
Submitted October 25, 2019 at 02:55PM by ArturCzemiel
Looking for a good tutorial on NestJS.
Wanting to move into Full Stack Typescript, and want to get a deep dive tutorial. I want to learn websockets and microservice architecture with this. Don't mind paying for a tutorial.
Submitted October 25, 2019 at 02:30PM by cjrutherford
Submitted October 25, 2019 at 02:30PM by cjrutherford
API Security
https://blog.restcase.com/state-of-api-security/
Submitted October 25, 2019 at 12:43PM by BugSmasher93
Submitted October 25, 2019 at 12:43PM by BugSmasher93
npm install zookeeper error applet not found shasum
Hello, I try to install zookeeper on a nodejs service, but this error appears "shasum: applet not foundUnable to download zookeeper library. "I tried to install shasum but the error remained, can anyone help me?
Submitted October 25, 2019 at 12:50PM by jenniemartins
Submitted October 25, 2019 at 12:50PM by jenniemartins
(Con)currently Unavailable — Troubleshooting the Node.js Event Loop
https://medium.com/reachnow-tech/con-currently-unavailable-troubleshooting-the-node-js-event-loop-cb488b59bbd2
Submitted October 25, 2019 at 11:23AM by whckytbccy
Submitted October 25, 2019 at 11:23AM by whckytbccy
How To Mock Services Using Mountebank and Node.js
https://www.digitalocean.com/community/tutorials/how-to-mock-services-using-mountebank-and-node-js
Submitted October 25, 2019 at 12:01PM by harlampi
Submitted October 25, 2019 at 12:01PM by harlampi
jscasts ep13 - Setup Babel with TypeScript on Node.js from scratch
https://www.youtube.com/watch?v=g9zx5xPTWF0
Submitted October 25, 2019 at 10:16AM by hotcto
Submitted October 25, 2019 at 10:16AM by hotcto
Thursday, 24 October 2019
I made Snake in electron.js
https://github.com/PhantomDerp/electron-snek
Submitted October 25, 2019 at 02:15AM by Phantomderpp
Submitted October 25, 2019 at 02:15AM by Phantomderpp
Can we do a video streaming with chunks of any video format ?
Hi,I want to develop a video player which will play video in chunks and can play any video format regardless of browser video support, is it possible ?I tried searching but can't understand, i'm new into node.
Submitted October 24, 2019 at 11:24PM by marsalans
Submitted October 24, 2019 at 11:24PM by marsalans
OpenJS Foundation launches new professional certification program
Hello,as there are now node certifications available who is in for them? I haven't seen an example of what will be expected though (maybe I haven't dig deep enough to find something?), would be interested in an example.Source: https://openjsf.org/blog/2019/10/22/openjs-foundation-launches-new-professional-certification-program-to-support-the-future-of-node-js-development/EDIT, best description I found so far: Exam tasks instruct you to complete a step, or a series of steps, which may be answered with Node.js core API’s or with any Node.js libraries/frameworks of the candidates choosing.
Submitted October 24, 2019 at 10:04PM by 1RandomPrinz
Submitted October 24, 2019 at 10:04PM by 1RandomPrinz
DRY form field definitions in express
Coming from a monolithic CMS background (Drupal, Wordpress, etc), I've got a question for those of you building on a modern stack. Recently I've been building a decoupled app using a js framework on the front and node(express) rest api on the back. The dev experience overall is GREAT compared to the oldschool PHP world. That said, I have one pretty big pain point that I'm wondering if anyone else has solved:With oldschool CMS' if you want a field on a piece of content, you add a field, give it a name, hit save. Easy. With the new architecture however the process is as follows: first, add the field to your form, then add the field to your front end model, then add the frontend validation for the field, then add the frontend submission handler for the field, then add the backend submission handler, then the backend validation, then add the field to the backend model, and finally write backend migrations for the field - and this isn't even including the use of a store, which you probably will. In all you've created at minimum 8 different files, spread out over two codebases, with a ton of duplication/replication throughout.Is this really what people are doing every time they want to add or update a field? This seems crazy to me. I feel like there should be some way of defining your fields/models ONCE, in a single file, and then have that file be used by the front and backend, for everything from form building to validation and submission. Is there is some sort of industry standard practice for doing this that I'm missing? The process described above seems unnecessarily complex and not at all in line with the DRY approach. Why is basic CRUD this messy?Someone enlighten me please!
Submitted October 24, 2019 at 08:51PM by eljimado
Submitted October 24, 2019 at 08:51PM by eljimado
Node ES6 JWT
JWT auth service with refresh using Node.js, ES6, Express, Sequelize and MochaRepository: https://github.com/murraco/node-es6-jwt
Submitted October 24, 2019 at 08:58PM by murraco
Submitted October 24, 2019 at 08:58PM by murraco
Node ES6 URL Shortener
URL Shortener in Base58 using Node.js, Express, Sequelize, Mocha and BootstrapRepository: https://github.com/murraco/node-es6-url-shortener
Submitted October 24, 2019 at 09:08PM by murraco
Submitted October 24, 2019 at 09:08PM by murraco
Background worker which works with other Languages
Hey guys, I'm looking for a background worker library/solution in Node.j. It should work with Redis. The tasks will be created from a Node.js Web Application and the tasks will be processed in any other language. Preferably in Java/C++.Please let me know if you've come across any such solution or have built something like this
Submitted October 24, 2019 at 07:29PM by jitendra_nirnejak
Submitted October 24, 2019 at 07:29PM by jitendra_nirnejak
Guide on building dynamic dashboard with react and Node.js
https://react-dashboard.cube.dev
Submitted October 24, 2019 at 06:41PM by MysticGoose
Submitted October 24, 2019 at 06:41PM by MysticGoose
run code every 5 seconds to collect the metrics
Hi,I have express api server and need to add feature to collect the metrics every 5 seconds and dump it into DB.but the 5 seconds is the default value, and users should be able to change it from ui.also user should be able to disable the metrics collection feature.what is the best practice on this kind of job
Submitted October 24, 2019 at 06:18PM by jkh911208
Submitted October 24, 2019 at 06:18PM by jkh911208
[HELP] Testing and deployment platform
I am deploying my app manually right now for my clients. Deployment process is pretty straight forward:Run testsCopy to target serverCopy customer's config.js (with customer specific things)Copy customer's assetsRestart the http serverThe same for ReactJS frontend (except config needs to be copy locally first and then production build is create).So basically, everyone is using the same code base with different assets and configs.Currently I have only a few customers, so I created simple shell scripts which do everything for me. However, I am counting on gaining new customers soon. The product is dynamically developed and updates are quite frequent. Thinking a little bit in the future, I am looking for a platform that would help me automate these tasks: testing, building, deploying, set up configs etc.Is there such a tool (preferred free/open and self hosted)?I would be grateful for guidance if someone has experience with a similar case.
Submitted October 24, 2019 at 05:19PM by kszyh_pl
Submitted October 24, 2019 at 05:19PM by kszyh_pl
Build Colorful Command-Line Spinners in Nodejs
https://blog.bitsrc.io/build-colourful-command-line-spinners-in-nodejs-6b94ceab80a1
Submitted October 24, 2019 at 04:35PM by JSislife
Submitted October 24, 2019 at 04:35PM by JSislife
How can I reduce the boilerplate for my UI projects? (Webpack+Pug+SCSS/LESS+...)
Sometimes I need to write some GUI for my node projects. It's beautiful how easy it is to integrate software written in node in a Web environment.I prefer to stay vanilla, and not use any big web framework. I'm usually writing my HTML with Jade or Pug, my styles with SCSS or LESS and manipulate the DOM using the standard browser JS API. I build all the JS code (including the node stuff and the dependencies) into a single JS file for the web using Webpack. I absolutely love this environment and the workflow.I'm a bit bothered by the amount of boilerplate that goes into every project with an UI though. In fact I always end up with:many many extra dependencies (e.g. css-loader, node-sass, style-loader, to-string-loader, webpack, webpack-cli, webpack-dev-server, usually even more).a 50+ lines webpack.config.js.several NPM scripts in package.json to start, build or test the web assets.I usually just copy and paste all these things from previous project, and only modify what's needed. That takes several minutes, feels very repetitive, the package.json becomes all cluttered and I hate how much code is duplicated between my various UI projects. This happens even with the tiniest UI projects, while it never happens in pure Node.Would anybody have any ideas on how to remove all this boilerplate?I've considered the idea of creating a metapackage that installs all the dependencies I usually need and offers a precooked webpack configuration that I can just require and, if needed, tweak. This solution seems quite hacky though... What's gonna happen if I decide to start use something else instead of Pug and SCSS, if I want to update some dependencies or if I start preferring different defaults? My metapackage would quickly become bloated with tons of dependencies even though each specific project only needs a few. The defaults would either become obsolete, or would break older projects...
Submitted October 24, 2019 at 03:49PM by RedditWideWeb
Submitted October 24, 2019 at 03:49PM by RedditWideWeb
Attaching a stream from localhost to node webserver
Hello,I am using my raspberry pi as a streaming video server, and also a webserver. .I am trying to attach the video stream to the node webserver, both running locally on the raspberry pi.There is a webcam streaming on port 8082 on my pi, but i dont want to expose that port to the world, just port 80 (for the webserver)var express = require("express");var app = express();var path = require("path");app.get("/", function(req, res) {res.sendFile(path.join(__dirname + "/index.html"));});app.listen(8080);My webserver, serving an index.html file with just a title and the stream (planning to add much more to this)
Submitted October 24, 2019 at 03:41PM by reactfanatic
My Streaming Site
That works when im testing locally obviously, but as I stated before I dont want to expose port 8082, just 80 for the website.Any assistance or even what to search for is greatly appreciated, as I am not really sure what to doSubmitted October 24, 2019 at 03:41PM by reactfanatic
Video Stream Example with NodeJs and HTML5
https://webomnizz.com/video-stream-example-with-nodejs-and-html5/
Submitted October 24, 2019 at 02:31PM by jogeshpi06
Submitted October 24, 2019 at 02:31PM by jogeshpi06
puppeteer released v2.0.0
https://app.releasly.co/releases/GoogleChrome/puppeteer/2_0_0?utm_campaign=r_node
Submitted October 24, 2019 at 02:48PM by scopsy
Submitted October 24, 2019 at 02:48PM by scopsy
You can find the explanation and example of how to use 3 fast template engine - Squirrelly, Marko, Swig that you can use in your expressjs application.
https://www.inkoop.io/blog/fast-template-engine-for-expressjs/
Submitted October 24, 2019 at 01:44PM by ameenashad
Submitted October 24, 2019 at 01:44PM by ameenashad
In your experience, which framework has the simplest routing?
I have a requirement where the only thing I need to do is route requests to other server. There's some logic but it's minimal. There's no session handling or DB work. What is your recommendation for this scenario?
Submitted October 24, 2019 at 10:59AM by sbmthakur
Submitted October 24, 2019 at 10:59AM by sbmthakur
Fast template engine for ExpressJs
https://www.inkoop.io/blog/fast-template-engine-for-expressjs/
Submitted October 24, 2019 at 07:58AM by ameenashad
Submitted October 24, 2019 at 07:58AM by ameenashad
Wednesday, 23 October 2019
Should data validation be handled within the definition of a class, or before creating a new instance of the class with that data?
Let's say you have a class that will be the structure of some data that you will then insert into a database with a function within the class like this:class Player { constructor (playerName) { this.playerName = playerName; } insert() { connection.query( "INSERT INTO Players (playerName) VALUES (?)", [this.playerName] ); } } const userInput = getUserInput().toString(); const player = new Player(userInput); player.insert(); Now let's say you decide names can only be 24 characters long and want to handle the validation somewhere in this block of code.Should you validate the data before creating the new Example instance, or should you create a function to validate the input inside the class definition?
Submitted October 24, 2019 at 02:27AM by g3t0nmyl3v3l
Submitted October 24, 2019 at 02:27AM by g3t0nmyl3v3l
How do you implement sharding in a Node.js, Express, Mongoose application?
https://mongoosejs.com/docs/guide.html#shardKeyThe documentation doesn't say much, I think the shard key takes for argument the fields in the schema you want to use for the key, but the example given should only work for the range-based sharding if I understand correctly.https://docs.mongodb.com/manual/reference/method/sh.shardCollection/I thought I had to implement my own logic for sharding, but it seems I just need to modify the schema when using it with Mongoose. The things that aren't clear however is how to use hashed sharding? Is it done configuration side? The doc says we need can only use 1 field, so does that mean it won't work if we provide 2 like in the example given?Also, how do we configure this properly if we use MongoDB Atlas?
Submitted October 24, 2019 at 12:49AM by jesusscript
Submitted October 24, 2019 at 12:49AM by jesusscript
Learn how to uploads files in Node.js and React.js with Formidable in 30 minutes
https://www.youtube.com/watch?v=jtCfvuMRsxE&t=484s
Submitted October 24, 2019 at 12:58AM by merunas
Submitted October 24, 2019 at 12:58AM by merunas
Has anyone tried AlaSQL?
Has anyone used AlasSql for any of their projects? If so, how good is it peformance wise? I want to try it but wanna know if it's worth it!
Submitted October 23, 2019 at 08:28PM by HTMLCSSJava
Submitted October 23, 2019 at 08:28PM by HTMLCSSJava
HELP! Error when I tried to run server
I've been getting this errors when I tried to run 'npm run dev'here's the log file https://pastebin.com/5NRZFdL4
Submitted October 23, 2019 at 06:15PM by ryusufu
Submitted October 23, 2019 at 06:15PM by ryusufu
What techonolgies/ORMs do you use for production/enterprise any why?
The title should say "and", not "any".I want to be able to build production-grade applications that have a clear separation between a domain model and a database entity. That is, I should be able to migrate ORMs, databases, etc., without having to touch domain logic. Thus, I want to utilize the Data Mapper pattern, not Active Record, as well as Repositories.TypeORM seems to sprinkle RBMS specific decorators across your entities, meaning you can't easily separate a domain model/entity from a database model/entity. I could build my own Repository around Mongoose, but then schema is being duplicated and validation logic has to be synced across the schema and any other models.These are my current issues, and maybe a basic query builder like Knex is a better option, but I'm sure that production-grade applications must be able to leverage MongoDB and still have a clear separation of concerns as well.So, what methods have used to get around the problems I'm facing? What are your preferred database systems and ORMs (if any) in production? How do you ensure a clear separation between the domain layer and persistence layer, etc., for your production applications?I'm working in TypeScript, personally, which is probably a better option for this kind of work anyway.Thank you.
Submitted October 23, 2019 at 06:20PM by JamieCorkhill
Submitted October 23, 2019 at 06:20PM by JamieCorkhill
What should be the interview preparation strategy and questions for a backend developer.
Working with Nodejs for 1.8 years. Never been involved in long term projects. Rusty on algorithms and data structures, SQL (worked with NoSQL from start). Although very well awared of modern front end scenerio but was not an active practioner and contributor when it came to front-end side for projects.
Submitted October 23, 2019 at 05:06PM by aakhri_paasta
Submitted October 23, 2019 at 05:06PM by aakhri_paasta
How to simply deploy an Express.js Server to Kubernetes
https://medium.com/@jerlam06/deploy-an-express-js-server-to-kubernetes-9e9f09c13a85?sk=d4460e8d1d62f7ce08e447beb791291a
Submitted October 23, 2019 at 04:46PM by Jerlam
Submitted October 23, 2019 at 04:46PM by Jerlam
node-powershell + active directory ps1 scripts = ghetto ADUC API?
instead of reinventing the wheel, im just curious if there could be a way to reuse all my powershell scripts, but just route them up in Express to run server side then spit back some JSON to the client end for display....then CRUD my way into an active directory api. ive messed around a bit using node-powershell, running some different scipts, and getting used to how the output works...but it seems doable, still trying to understand the output part.so im always leery when it seems like im the only one wondering stuff...i havent seen hardly any chatter about using this node-powershell package as a way to get a really easy ADUC api going. You already have all the powershell cmdlets there, or any personal scripts...i figured it was worth a try, or either start learning ldapjs, which im not sure im up to right now. i have lots of enable or disable scirpts i use when folks hire on, or get termed, that goes out to a lot of extra endpoints to turn down other accounts and do cleanup, we're O365/hybrid...sure would kick ass if I could reuse those.OR, is there a more optimal way of invoking ps scripts server side using node.js/express? none of the ps1 scripts i use run over 15-20 seconds, not huge cpu crunching or anything, mostly just waiting for aduc to talk back, or when reaching out to other API's, which i'd probably bring those out of their ps1 scripts and do the fetching from express directly.....but the AD stuff seems doable if there isnt a gaping security angle im not seeing yet...
Submitted October 23, 2019 at 04:15PM by MajDogbyte
Submitted October 23, 2019 at 04:15PM by MajDogbyte
Formatting JavaScript Dates with Moment.js
http://thecodebarbarian.com/formatting-javascript-dates-with-moment-js.html
Submitted October 23, 2019 at 03:05PM by code_barbarian
Submitted October 23, 2019 at 03:05PM by code_barbarian
How to use Firebase Auth with a custom (node) backend
https://medium.com/@dpeachesdev/how-to-use-firebase-auth-with-a-custom-node-backend-99a106376c8a
Submitted October 23, 2019 at 02:16PM by EvoNext
Submitted October 23, 2019 at 02:16PM by EvoNext
How to Add a Role-Based Admin Panel to Node.js App in 10 Minutes | software Brothers Blog
https://medium.com/@softwarebrothers/how-to-add-a-role-based-admin-panel-to-node-js-app-in-10-minutes-f6a033fc8ce8
Submitted October 23, 2019 at 02:21PM by SoftwareBrothers
Submitted October 23, 2019 at 02:21PM by SoftwareBrothers
modular-aws-sdk-pure-node: the aws-sdk without any clutter
I have developed a lot of node.js services running on AWS (EC2) and using the aws-sdk. What always had bothered me is the size of the aws-sdk! Annpm install --save aws-sdk gives you 43 megabytes of full blown aws-sdk. I peeked inside the installed folder, and behold, there is a lot of stuff I, as a node.js developer, don't need: dist, dist-tools, files for supporting the sdk running in the browser.So, I wrote a small script (https://github.com/Junkern/modular-aws-sdk/blob/master/scripts/createPureNodeJsAWSSDK.sh) which gets rid of not needed files and folders and I published the resulting package. Installing the modular-aws-sdk-pure-node package (https://www.npmjs.com/package/modular-aws-sdk-pure-node) now results in a size of 30 Megabytes.This is, however, still a lot, especially when you are using only one service (e.g. DynamoDB) of the SDK.So, I analyzed the aws-sdk and found a way to create the whole SDK for only one service! When you use only the DynamoDB, you can save ~40 megabytes by installing the modular-aws-sdk-dynamodb package, instead of the aws-sdk. (Take a look at https://github.com/Junkern/modular-aws-sdk to find out more)I am a huge fan of keeping applications small, so I hope I can help you lowering the size of your applications, reducing costs and saving time while installing dependencies ;)Feel free to criticize, ask questions, come up with improvements :)I also see some cons of my approach:How can someone make sure that I did not alter the original aws-sdk in any way? => Maybe hash folder contents to prove that I did not alter anything?Does everything still work? => Tests are on my agenda. And I am using e.g. modular-aws-sdk-dynamodb in production, so far everything works fine :P
Submitted October 23, 2019 at 12:29PM by EverythingIsGoingUp
Submitted October 23, 2019 at 12:29PM by EverythingIsGoingUp
Node v13.0.1 (Current)
https://nodejs.org/en/blog/release/v13.0.1/
Submitted October 23, 2019 at 12:51PM by dwaxe
Submitted October 23, 2019 at 12:51PM by dwaxe
Tuesday, 22 October 2019
You don't need passport.js - Guide to node.js authentication
https://softwareontheroad.com/nodejs-jwt-authentication-oauth/
Submitted October 22, 2019 at 10:40PM by dobkin-1970
Submitted October 22, 2019 at 10:40PM by dobkin-1970
How to keep in sync MongoDB with MySQL
Long story short, I have a legacy app written in PHP/MySQL stack which I’m rewriting in Node/MongoDB module by module. How can I migrate the user management module (as an example) to MongoDB when a lot of other PHP modules are dependant on the MySQL record id. For now I’m keeping them in sync using a messaging system but I’m worrying about this split brain situation.
Submitted October 22, 2019 at 08:51PM by k0d17z
Submitted October 22, 2019 at 08:51PM by k0d17z
Node v10.17.0 (LTS)
https://nodejs.org/en/blog/release/v10.17.0/
Submitted October 22, 2019 at 09:14PM by dwaxe
Submitted October 22, 2019 at 09:14PM by dwaxe
Postgres, upsert, transactions, and KnexJS
Hope this is the right place to ask this.I'm working on a project using Node and Postgres, with Knex serving as the query builder. Knex has been working great so far but I'm realizing it doesn't easily support any ON CONFLICT statements. My system has to replace existing data with new incoming information quite often, so this is a bit of a problem.I've found some workarounds for the lack of upsert functionality (namely using knex.raw()) but I have hesitations regarding the security of this, as well how to format it for use within a transaction.Is it possible to do this with Knex? Would a different Node query builder accommodate my needs better? Thanks for any input.
Submitted October 22, 2019 at 09:30PM by MindBodyLightSound
Submitted October 22, 2019 at 09:30PM by MindBodyLightSound
Getting the Request Body in Express - Mastering JS
https://masteringjs.io/tutorials/express/body
Submitted October 22, 2019 at 09:41PM by code_barbarian
Submitted October 22, 2019 at 09:41PM by code_barbarian
Did a fresh install of Pop!_OS 19.10 (ver # same as ubuntu), nodejs says it is not supported
i just did a fresh install of pop os 19.10 which is the same as ubuntu 19.10. i wanted to install nodejs but the website shows it is only supported to 19.04. when i tried to install via bash, it does a check on your OS version and if it is not officially supported, the installation is automatically cancelled. any suggestions?
Submitted October 22, 2019 at 08:59PM by RaD---RaD
Submitted October 22, 2019 at 08:59PM by RaD---RaD
OpenJS Foundation launches new professional certification program to support the future of Node.js development
https://openjsf.org/blog/2019/10/22/openjs-foundation-launches-new-professional-certification-program-to-support-the-future-of-node-js-development/
Submitted October 22, 2019 at 08:11PM by Waryjot
Submitted October 22, 2019 at 08:11PM by Waryjot
What would subjectively be the name of the directory that you'll place your test files in?
I've seen many projects and libraries on GitHub (and elsewhere) storing test files in a directory named either as 'tests' or 'test', mostly the first one. I've done it for my open-source (and closed-source) projects as well but I prefer 'tests' to denote that there are multiple test files. Though this is purely subjective, this question has always bothered me for which one of the two would sound more appropriate, I guess the plural name 'tests'?
Submitted October 22, 2019 at 07:15PM by myTerminal_
Submitted October 22, 2019 at 07:15PM by myTerminal_
Wrapping my head around Async/Await with node-fetch / axios
TL;DR Every tutorial just has "console.log(res.json())" - not helpful. Has anyone "chained" fetch or axios? The tool I'm writing will be open source but I want to get a head start on it before I'm supposed to be working on it, so I can't really share my code.The github API will list all of my Repos just fine. I can based on that list filter it and return it to only include repos authored by me. I can pass that list into a function to fetch a second request => *the contents of each repo*. Now I'm stuck. From the contents JSON, I need to "store" in memory a list of "files" and a list of "directories", then do operations on the files, and repeat the listing of directories with another fetch, just once more (not recursively beyond that), and do operations on the files in the second level directories.Any help would be greatly appreciated, if there's a request maybe I'll post a 24 hour pastebin.
Submitted October 22, 2019 at 07:46PM by dmattox10
Submitted October 22, 2019 at 07:46PM by dmattox10
Build database relationships with Node.js and MongoDB
https://employbl.com/blog/nodejs-mongoose-relationships-database
Submitted October 22, 2019 at 06:27PM by connor11528
Submitted October 22, 2019 at 06:27PM by connor11528
Node v13.0.0 (Current)
https://nodejs.org/en/blog/release/v13.0.0/
Submitted October 22, 2019 at 06:15PM by ThinkNotice
Submitted October 22, 2019 at 06:15PM by ThinkNotice
Shared electron stack?
From my understanding, electron apps all bundle their own V8 instance and bring all their dependencies with them.Is there a way to share these resources? If JS backed applications are getting more common (and they seem to be), why not just share whatever libs they need and run them on the same instance, much the same a browser would?
Submitted October 22, 2019 at 03:50PM by teh_mICON
Submitted October 22, 2019 at 03:50PM by teh_mICON
Doing it Right: Private Class Properties in JavaScript
https://blog.bitsrc.io/doing-it-right-private-class-properties-in-javascript-cc74ef88682e
Submitted October 22, 2019 at 04:04PM by JSislife
Submitted October 22, 2019 at 04:04PM by JSislife
What are some useful libraries for Node.js Express.js developers?
I am building an API and want to add more features, but I don't know what libraries I should use. Feel free to recommend me some.
Submitted October 22, 2019 at 03:07PM by jesusscript
Submitted October 22, 2019 at 03:07PM by jesusscript
How to structure my DAO for synchronous use?
I have a User DAO function that is supposed to return an User:exports.findUser = async function(username) { try { return await User.find({ username: username }); } catch { console.log("User not found"); return null; } } Now, all the functions in my DAO are async because I am waiting for find the User in the database. However, I need to use these async functions in synchronous functions:I need to use the findUser method in the controller. This is easy because I can just treat it as a promise and then use then() to do res.json(user)I need to return the user in my authentication function from the thenable scope. Like this: function (username, password, cb) { console.log(password); userDAO.getUser(username, userModel).then(user => { if (user == null) { return done(null, false, {message: 'User not found with that username.'}); } else { return done(null, user, {message: 'Logged in successfully'}); } } Would I be able to return to the outer function from a thenable scope?Do you guys think this is the right approach to create a DAO? Do you have any recommendations?
Submitted October 22, 2019 at 02:36PM by Maegar
Submitted October 22, 2019 at 02:36PM by Maegar
Help with "POST" with Express JS
Hello!I'm new to this Node JS thing, We got a task to fix a problem but I'm here stuck for the past 2 weeks not knowing what to do. The teacher told us we need to add 2 lines to fix the problem.Here is my code can somebody help me ? Thanks <3const express = require("express"); const app = express(); const { decode } = require("querystring"); const { updateDb } = require("./myModule"); const clientDir = __dirname + '\\client\\'; app.get('/', (requset, response) => response.sendFile(clientDir + 'home-page.html')); app.get('/contact', (requset, response) => response.sendFile(clientDir + 'contact.html')); app.get('/codeofconduct', (requset, response) => response.sendFile(clientDir + 'codeofconduct.html')); app.get('/testgame', (requset, response) => response.sendFile(clientDir + 'testgame.html')); app.get('/client/testgame.js', (requset, response) => response.sendFile(clientDir + 'testgame.js')); app.get('/img/niklas.jpeg', (requset, response) => response.sendFile(clientDir + 'niklas.jpeg')); app.get('/img/become-a-good-programmer.jpeg', (requset, response) => response.sendFile(clientDir + 'become-a-good-programmer.jpg')); app.get('/styles.css', (requset, response) => response.sendFile(clientDir + 'styles.css')); app.get('*', (requset, response) => response.sendFile(clientDir + '404.html')); app.post('handle', (request,response) => { let query1=request.body.name; let query2=request.body.email; let query3=request.body.message; // HERE I NEED TO ADD THOSE 2 LINES! console.log(); }); app.listen(3000); console.log("My personal website runnning on port 3000");
Submitted October 22, 2019 at 10:53AM by Petrov2g
Submitted October 22, 2019 at 10:53AM by Petrov2g
Node Cron Time/Expression generator.
Just in any case you are finding cron expressions difficult you can use cron-time-generator package from npm. We wrote it.Example:https://i.redd.it/92qnp664c2u31.pngGit Repository: GitHub | Cron Time Generator
Submitted October 22, 2019 at 10:33AM by xpresserjs
Submitted October 22, 2019 at 10:33AM by xpresserjs
Why can’t I ever get my server and front end to connect when booting up a project after the first time?
TLDR: Help...I’m not sure how to re open up a project...(MERN)I’m in the process of learning node. I don’t have any problems getting the server to run and be connected with the front end when I am setting everything up.But, when I go to it the next day, my server will be running on local host 5000 and my front end browser will show local host 3000...Every time I open up the files do I need to install all my dependencies again?
Submitted October 22, 2019 at 09:33AM by investoearth
Submitted October 22, 2019 at 09:33AM by investoearth
Monday, 21 October 2019
What's the best community/forum cms for node js
I've seen a lot of good cms's for blogging and article publishing, like ghost and keystone. but I cant seem to find a good cms for forums and communitiesis there anything like a community cms you guys recommend? or would it just be better if i make one myself?
Submitted October 22, 2019 at 07:01AM by hhw1208
Submitted October 22, 2019 at 07:01AM by hhw1208
Which is te best free node js tutorial currently?
Am looking to scale my skill from UI developer to Full-Stack. Can you please suggest me any tutorial for Advance Node js. Am having basic knowledge in Node.
Submitted October 22, 2019 at 05:45AM by interstellar007
Submitted October 22, 2019 at 05:45AM by interstellar007
Introducing Expressive Tea v1.1.0
https://i.redd.it/8axg4yinlxt31.pngSince 7 months until now my company is working on a express base framework using Typescript as main language which we named Expressive Tea. This using typescript mainly to use the Decorators which allow to write clean and less code. We wanted to do this as a pluggable and modulable framework to allow developers share code between projects, also, we wanted to be neutral so we detoxify our code to not force it to use one type of architecture (named MEAN, MERN, etc), that is because We wanted every developer decide their own flavor.Of course We know sometimes developers want to use a kind of architecture or settings, like someone use MongoDB with Mongoose, or just PostgreSQL, from Angular to React. That is why on the latest version we add a plugin engine that allows share many flavors of Expressive Tea.If anyone wants to give it a try you can get the project information here, also if you want to try the new plugin feature you can take a look here. If you want to know a little bit how this is working you can see the video that we have it (just warning is a little big so don't rush on this) or you can follow the tutorial series on medium here.Thanks for reading and your comments/suggestions.
Submitted October 21, 2019 at 06:58PM by diegoresendez83
Submitted October 21, 2019 at 06:58PM by diegoresendez83
Actions, Tasks, and Destructured Params- The Illustrated Actionhero Community Q&A
https://blog.evantahler.com/actions-tasks-and-destructured-params-the-illustrated-actionhero-community-q-a-a3128f41b2ee
Submitted October 21, 2019 at 05:40PM by evantahler
Submitted October 21, 2019 at 05:40PM by evantahler
I love this sub!
Most of the time I read the headline I think "lol programmercirclejerk is so funny" and then I realize it's serious.Thanks for being great entertainment, cheers!
Submitted October 21, 2019 at 04:38PM by teh_mICON
Submitted October 21, 2019 at 04:38PM by teh_mICON
Any Romanian developers here?
Hi,There is here any Node.JS developer from Romania (Iasi)?Thank you!
Submitted October 21, 2019 at 03:45PM by sabinagav
Submitted October 21, 2019 at 03:45PM by sabinagav
How to get front end to see .env contents?
I'm working on an app that has client side and server side hosted on two seperate heroku deployments. When I hard code the url in the axios call from the front end to the back end it works in the production environment:auth.js file:const baseUrl = 'https://url.herokuapp.com/'function Auth() { axios.get(baseUrl + 'api/user', test)But if I add the following to the .env file and change the code as below it doesn't work:auth.js file:const baseUrl = process.env.REACT_APP_SERVER_URL || '/'function Auth() { axios.get(baseUrl + 'api/user', test).env file:if (process.env.NODE_ENV !== 'production') { REACT_APP_SERVER_URL = "http://localhost:3001/"} else { REACT_APP_SERVER_URL = "https://url.herokuapp.com/"}I've tried adding and installing dotenv to a route server.js file on the front end but now luckrequire('dotenv').config();Any ideas?
Submitted October 21, 2019 at 03:25PM by hello_isitmeyoulook4
Submitted October 21, 2019 at 03:25PM by hello_isitmeyoulook4
How do I use JWT with multer-s3?
Since they're both middleware, how do I use JWT before multer-s3? Is it like app.post('/route', verifyToken, aws.array('files', 50), (req, res, next) => {});
Submitted October 21, 2019 at 01:38PM by sinithw
Submitted October 21, 2019 at 01:38PM by sinithw
Hey, we are working API design service for you
Hey 👋. We are working on the solution to help you to improve API designing and maintain it. I wanna hear your feed back and desires.Please leave your thoughts and feedback: https://docs.google.com/forms/d/e/1FAIpQLSdexeDXG71c2ttAbyuQTdkKal5xGRIKkp4Tfkx__b4TxSn_aA/viewform?usp=sf_linkThanks. I appreciate your responses !)
Submitted October 21, 2019 at 01:54PM by alevona
Submitted October 21, 2019 at 01:54PM by alevona
Convert between Strings, Buffers and Objects in Node.js
https://www.codelime.blog/convert-between-strings-buffers-and-objects-in-nodejs/
Submitted October 21, 2019 at 12:56PM by r-randy
Submitted October 21, 2019 at 12:56PM by r-randy
Downloading a zip archive from Express endpoint
Hello, everyoneI have a simple issue, but it's been driving me crazy for the past 2 days. I have an archive.zipfile in my node/express app which I'm trying to send via a response. My code is pretty simple, I have an endpoint /download whos only job is to do response.download("archive.zip")However, upon downloading the file (by accessing the URL through a browser), the .zip archive is downloaded, but the files in the archive are corrupted, and I get the error Unexpected end of archive.The actual file is a good, non-corrupted archive. I can access it on the windows filesystem without any problems. It's just when it gets transferred it gets corrupted.I have tried setting various response headers, among which:Content-Disposition: attachment Content-Type: application/zip, application/content-stream Transfer-Encoding: chunked Nothing has worked up to this point. I have searched far and wide on google / reddit / stackoverflow and haven't come up with a solution so far.Thank you for any or all responses.
Submitted October 21, 2019 at 01:12PM by remus2232
Submitted October 21, 2019 at 01:12PM by remus2232
Node v12.13.0 (LTS)
https://nodejs.org/en/blog/release/v12.13.0/
Submitted October 21, 2019 at 11:14AM by dwaxe
Submitted October 21, 2019 at 11:14AM by dwaxe
Deep Dive Into Node.js Module Architecture
https://medium.com/@gotoflorian.pro/deep-dive-into-node-js-module-architecture-b80fbd22dacb?source=friends_link&sk=a4c5422375309231dc45605fc10a21f9
Submitted October 21, 2019 at 09:49AM by EvoNext
Submitted October 21, 2019 at 09:49AM by EvoNext
Two ways to strengthen your GraphQL API
https://blog.graphqleditor.com/three-ways-to-strengthen-graphql-api/
Submitted October 21, 2019 at 10:24AM by oczekkk
Submitted October 21, 2019 at 10:24AM by oczekkk
Sunday, 20 October 2019
NodeJS nested function. How to get value?
Hello together,i am working on my first nodejs project. Currently i struggle on one special syntax from nodejs:I have developing expercience, but never seen such before :DThis special "then" syntax and scoping. For example i have this code:keyVaultClient.getSecret(vaultUri, "key", "").then(function(response){console.log(response);})How do i access the variable response from my code outside the function?I have seen a lot of code with such special nested syntax. So how i can handle the scoping?Where i can find information about these syntax and scoping.?Best greetings
Submitted October 21, 2019 at 07:39AM by superfliege90
Submitted October 21, 2019 at 07:39AM by superfliege90
Help needed - Survey on Code Smell Harmfulness
Hi there, I'm a MSc Student on Software Engineering from Brazil. I'm currently studying the Code Smell Harmfulness. I refer to "Smells" as pieces of code that need to be improved. Examples of these code smells are Long Methods (method that is too long and tries to do too much) and God Class (classes that tend to centralize the intelligence of the system). By code smells harmfulness, we mean code smells that can degrade the software quality, e. g., bug-prone code smells.I would like to kindly invite you guys to participate in a survey on this topic. The goal of this survey is to identify the perceptions of professionals regarding the harmfulness of code smells.Answering the survey should take around 3 minutes of your time.Link: https://forms.gle/QzN9nPHj9Peu9ZG17All the data collected from the survey is anonymous. The results of the survey may be reported in academic publications. If you have any questions or concerns, please contact me (Rodrigo Lima) [rsl@ic.ufal.br](mailto:rsl@ic.ufal.br).Thanks, It will be very helpful the answers from you guys,Rodrigo Lima
Submitted October 21, 2019 at 04:29AM by rodrigoliimaa
Submitted October 21, 2019 at 04:29AM by rodrigoliimaa
How do you handle errors in your Repositories/Data Access Layer?
I'm working in TypeScript, and I have a Repository that encapsulates my ORM's query building API. To sign up a user, for instance, a Controller Action delegates to a Service, which calls methods of my Repository.I impose particular constraints with my ORM, such as stating that an email field must be unique. That means that my Repository's save and update methods for the user could throw an error by the ORM. If that's the case, and for the purpose of abstraction, I obviously want to encapsulate that error with some custom error type.So, should my Repository functions intentionally throw domain-specific errors to be caught by the Service? I was considering letting errors bubble up all the way to the Controller, and then handling it with Express Middleware to return a proper response to the client. Another option might be to build an Either Monad result wrapper for my Repository functions and have them return that.Do you have any advice?Thank you.
Submitted October 21, 2019 at 12:53AM by JamieCorkhill
Submitted October 21, 2019 at 12:53AM by JamieCorkhill
How do I update the database after a keyup event or at the very least setinterval()?
So I want to implement a sort of drafts feature, like how Gmail will save your written email in drafts before sending it and updates a few seconds every time after typing something. I want to update the database in a drafts table after every few keystrokes but I don't believe you can do jQuery to database as it's front-end, so I'm not sure how email services are able to do that. If that method isn't feasible, can I do a setinterval() around a callback function that updates database?
Submitted October 21, 2019 at 12:55AM by programmerbyday12345
Submitted October 21, 2019 at 12:55AM by programmerbyday12345
Using Clean Architecture for Microservice APIs in Node.js with MongoDB and Express
https://www.youtube.com/watch?v=CnailTcJV_U
Submitted October 20, 2019 at 10:42PM by dobkin-1970
Submitted October 20, 2019 at 10:42PM by dobkin-1970
SSR vs CSR. Template Engine vs API+Frontend separated
Hi guys, i am learning Node.js and i have a question.I want to build a Node.js API (Node+Express+Mongo, with tokens, etc.) and also a React frontend page.The question is, what is better and why?:All in Node with Server Side Rendering (SSR) using a Template Engine (like EJS, Pug..)API with Node.js and website with React (Client Side Rendering CSR) on a Nginx server for sending html+css+js files.I saw that SSR is faster, but the problem is that rendering is a sync process and it means that server will only process about two requests per second (or something like that i read) and if you have a lot if requests at the same time, you have a problem.
Submitted October 20, 2019 at 10:54PM by JaMoLpE88
Submitted October 20, 2019 at 10:54PM by JaMoLpE88
Emitterly ⚡️ Create triggers from file streams
https://github.com/michaeldegroot/Emitterly
Submitted October 20, 2019 at 11:56PM by AccomplishedAccount5
Submitted October 20, 2019 at 11:56PM by AccomplishedAccount5
How do you use jsonwebtoken with multer-s3?
Since jwt uses a middleware implementation and so does multer, how do I use them together?
Submitted October 21, 2019 at 12:18AM by sinithw
Submitted October 21, 2019 at 12:18AM by sinithw
Check your website for issues using website-checks
website-checks checks a given domain name for different issues (accessibility, performance, security) using the following services:crt.sh CryptCheck HSTS Preload List HTTP Observatory Lighthouse PageSpeed Insights Security Headers SSL Decoder SSLLabs webbkoll webhintThe resulting reports are saved as PDF files.Find all further information and installation instructions at https://github.com/DanielRuf/website-checks
Submitted October 20, 2019 at 05:34PM by DanielRuf
Submitted October 20, 2019 at 05:34PM by DanielRuf
Help. How make the structure of microservices to nodejs
Hi everyone, there are someone that worked with nodejs and microservices , can help me. I want yo Know how to make the strucutre folders, files to test, files to config etc. And other tips
Submitted October 20, 2019 at 05:36PM by dudadedu
Submitted October 20, 2019 at 05:36PM by dudadedu
Get the list of most active users in GitHub by country from GitHub Graph API using JavaScript in Node.js
https://github.com/gayanvoice/GitHubStats
Submitted October 20, 2019 at 03:42PM by GayanKuruppu
Submitted October 20, 2019 at 03:42PM by GayanKuruppu
Need help with MongoDB database structure
Hey,I am making a server synced diary application with NodeJS, and using MongoDB. I have all my super relational data in MySQL. But for users Daily memoirs im going to use Mongo, because as you may have realised, there will be a crap load of notes/day diaries, and I want to learn MongoDB, and it is supposed to be way better for lots of non relational data.I have learned how to create DBs and do everything, but something all the tutorials dont cover, is the most important thing of all, how do I structure my data?Down below I have several examples of what ive thought, and as I am pretty unexperienced with Mongo, I would like some advice, on which option would be the best performance wise.Thank you in advance for your time, and any help!Example 1: My database has one HUGE collection called “Days” and each entry to that collection looks like this: (I am sorry, but no matter how much I think about it, this sounds like the least performant option, as said I am unexperienced in Mongo, and might be wrong.){userID: 902, //This user ID will be fetched from MySQL when authenticating users request. From what ive read, I need to run a command similar to this: “db.posts.createIndex( { author_name : 1 } )”, on this collection to somehow optimize performance? //What day? No, I wont use Date for this, because then id have to turn my JSON Query data to Date before querying (Maybe I wouldnt have to, as Mongo may store it as string anyway). BUT, I am not sure whether i should use 3 separate Integer fields, or one string field. Which would be faster? (EDIT: I know three separate fields with int will be WAY faster, as my application also has to query data for one month, etc. MAYBE Im wrong, and this is bad practice, let me know.) day: 12, month: 5, year: 2018, //Actual stored data: dayTitle: “Lame day at home..”, dayDescription: “Installed arch..”, hugeLoadOfIndividualSmallNotesForThisDayWithTimeStamps: [ { data: “Woke up, start now”, time: “9:44”, { data: “Finally figured out what fdisk is”, time: “21:29” } } … ] }Example 2: My database has a collection for each user which is named by their userID (This sounds VERY good and organized to me, and with my common sense, it would sound like the most performance one, but from what I googled, people said this wouldnt be good, and thats EXACTLY why I am asking here), and each entry to that collection looks like this:{day: 12, month: 5, year: 2018, dayTitle: “Lame day at home..”, dayDescription: “Installed arch..”, hugeLoadOfIndividualSmallNotesForThisDayWithTimeStamps: [ { data: “Woke up, start now”, time: “9:44”, { data: “Finally figured out what fdisk is”, time: “21:29” } } … ] }Example 3: My database has a collection for each day. (This is basically same as example 2, but there will be less collections. I am very unsure whether this would be bettter than option 2 performance wise, and also this would KIND of, be harder to implement because days change etc.), and each entry to that collection looks like this:{userID: 902, dayTitle: “Lame day at home..”, dayDescription: “Installed arch..”, hugeLoadOfIndividualSmallNotesForThisDayWithTimeStamps: [ { data: “Woke up, start now”, time: “9:44”, { data: “Finally figured out what fdisk is”, time: “21:29” } } … ] }As said before, thanks in advance guys!
Submitted October 20, 2019 at 01:29PM by livinglibary
Submitted October 20, 2019 at 01:29PM by livinglibary
Is using 'location.assign' a bad idea for a get request
Using express for reference.Context: Basically I'm rendering a list (via ajax front end) but at this point I'm not using any href's for each list item. Instead if the item is clicked it is grabbing a dataset value. That works and I can send the request from axios to express and get my data back. It's a 'GET' request since I have no form elements in the list.Problem: So the item that is retrieved requires a good amount of html. I think it might be better to just use a pug template on the back end and have express render it (instead of front end rendering). The problem is with the way things are set up (no hrefs) the only way I figured out to make it work is doing a location.assign('/route/id').It works but I have a sneaking suspicion that it maybe a bad practice.tl;dr: Is using location.assign a bad idea for sending a 'GET' request ?
Submitted October 20, 2019 at 02:24PM by fickentastic
Submitted October 20, 2019 at 02:24PM by fickentastic
Having trouble hiding button inside my pug file
Hi there, im truly appreciate it if anyone can help me towards my problem or point where my mistake is. Currently I wanted to hide a button inside my pug file if certain condition is met. The condition I set inside my pug file is that if the user.id is equal to the tournament.author, only show the button if its belongs to the user otherwise hide. I created this condition is to not let other user edit or delete the tournament post. Below are some code I provide to help anyone identify what did I missed.mongodb sample data> db.tournaments.find().pretty() { "_id" : ObjectId("5dab977fcec7714424b1ad0f"), "date" : ISODate("2019-10-19T23:08:47.521Z"), "title" : "Post1", "author" : "5dab7d10b9b5c73de0ed0ea2", <--- should be the same with user.id > db.users.find().pretty() { "_id" : ObjectId("5dab7d10b9b5c73de0ed0ea2"), <---- should be the same with tournament.author "date" : ISODate("2019-10-19T21:16:00.541Z"), app.jsapp.get('*', function(req, res, next){ res.locals.user = req.user || null; next(); }); tournament.js//Show Single Tournament router.get('/:id', function(req, res){ Tournament.findById(req.params.id, function(err, tournament){ User.findById(tournament.author, function(err, user){ res.render('tournament',{ tournament: tournament, author: user.username, }); }); }); }); //Submit To Create Tournament router.post('/create', ensureAuthenticated, function(req, res){ req.checkBody('title', 'Title is required').notEmpty(); req.checkBody('size', 'Size is required').notEmpty(); req.checkBody('type', 'Type is required').notEmpty(); req.checkBody('body','Body is required').notEmpty(); let errors = req.validationErrors(); if(errors){ res.render('create_tournament', { errors: errors, user: req.user, }); } else{ let tournament = new Tournament(); tournament.title = req.body.title; tournament.author = req.user._id; tournament.size = req.body.size; tournament.type = req.body.type; tournament.body = req.body.body; tournament.save(function(err){ if(err){ console.log(err); return; } else{ req.flash('success', 'Tournament created'); res.redirect('/'); } }); } }); //Submit Edited Tournament router.post('/edit/:id', ensureAuthenticated, function(req, res){ let tournament = {}; tournament.title = req.body.title; tournament.author = req.user._id; tournament.body = req.body.body; let query = { _id:req.params.id } Tournament.update(query, tournament, function(err){ if(err){ console.log(err); return; } else{ req.flash('success', 'Tournament updated'); res.redirect('/'); } }); }); tournament.pug (example screenshot).card-body strong Player Slots: | #{tournament.size} br strong Bracket Format: | #{tournament.type} p.card-text |!{tournament.body} p.card-text small.text-muted #{tournament.date} by #{author} if user .btn-group.float-right if user.id == tournament.author a.btn.btn-outline-dark.btn-sm(href='/tournament/edit/'+tournament._id) Edit a.btn.btn-outline-dark.btn-sm.delete-tournament(href='#', data-id=tournament._id) Delete
Submitted October 20, 2019 at 12:59PM by exspade
Submitted October 20, 2019 at 12:59PM by exspade
Is Node.js the right choice
I am working on a project, for which we need a (live) Web-Dashboard. We decided to go with node for the backend.Doing some research i found nothing about the average size of the package tree coming with importing a package. Also i didn't find anything about how proportional a project grows with the packages. (If iam doing a really small application is the package tree proportional to it or does it bloat the whole project.Can you point me to some sources where i can read about it?
Submitted October 20, 2019 at 01:17PM by ma____x
Submitted October 20, 2019 at 01:17PM by ma____x
Fuzz Testing For Javascript/NodeJS
https://github.com/fuzzitdev/jsfuzz
Submitted October 20, 2019 at 12:16PM by jekapats
Submitted October 20, 2019 at 12:16PM by jekapats
Env encryption tool that will help you prevent attacks from npm-malicious-packages | GitHub - kunalpanchal/secure-env
https://github.com/kunalpanchal/secure-env
Submitted October 20, 2019 at 10:53AM by panchalkunal
Submitted October 20, 2019 at 10:53AM by panchalkunal
Creating my first "full stack" app. Some questions.
I'll create a simple app. It will be a CRUD (Create, Read, Update and Delete) app that I will use for practicing.It will have a BE: Database + APIAnd a FE: Website and mobile app.For the BE I'm using NodeJS, Express, MongoDB. As explained on this tutorial on Guru99.I'm used to SQL databases. However it seems that MongoDB doesn't use SQL. But that's not a problem, I can learn whatever it uses.The API will have a few endpoints, with GET, POST, PUT, DELETE, etc.For the FE I'll just use JS and probably React and React Native once I'm done with everything and have time to learn React and RN.Do you think I'm well headed? Any advice/tip you might want to share with me?
Submitted October 20, 2019 at 07:55AM by former_farmer
Submitted October 20, 2019 at 07:55AM by former_farmer
node-fetch not returning expected message
[Solved]I'm trying to use node-fetch with IFTTT to make a post request. The request works fine and I receive my notification set with the webhook, but there is one thing that is bothering me and I haven't been able to figure out how node-fetch is handling the response.const body = { value1: currentTemperature }; fetch('https://maker.ifttt.com/trigger/temp_reading/with/key/' + key, { method: 'post', body: JSON.stringify(body), headers: { 'Content-Type': 'application/json' }, }) .then(function (res) { //res.json() res.text(); console.log(res); }) .then(function (text) { console.log(text); // returns undefined }) .catch(function (err) { console.log('node-fetch error: ', err) }); Which returnsResponse { size: 0, timeout: 0, [Symbol(Body internals)]: { body: PassThrough { _readableState: [Object], readable: true, domain: null, _events: [Object], _eventsCount: 4, _maxListeners: undefined, _writableState: [Object], writable: false, allowHalfOpen: true, _transformState: [Object] }, disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'https://maker.ifttt.com/trigger/temp_reading/with/key/key-removed', status: 200, statusText: 'OK', headers: Headers { [Symbol(map)]: [Object] }, counter: 0 } } undefined In for example, Postman or CURL, I see the resultCongratulations! You've fired the temp_reading eventInstead, with node-fetch, it returns undefined in the node console.Why does it return undefined instead of the success message? Thanks.
Submitted October 20, 2019 at 07:59AM by hey__its__me__
Submitted October 20, 2019 at 07:59AM by hey__its__me__
Subscribe to:
Posts (Atom)