I have some experience in Nodejs/Express, Sequelize and jwt apps.
Recently I started looking at API Designing tools/Specs like RAML -- API Designer, Swagger -- Swagger Tools
I am wondering and I found no article linking or pointing out that how can I use swagger to create/design APIs and then use it in my nodejs/express app which uses Sequelize as an ORM.
JWT functionality is added on to middleware for authentication & authorization.
As I tested so far, I can export nodejs scaffolded app structure from Swagger-Editor using Server Code. On inspection, it actually routes the calls to swagger/YAML files.
How can I use sequelize alongside it?
Also, how do you guys go around from API Spec/Design to App (tools or workflow).
Please point where I am going wrong.
You can take a look at the official documentation here. The docs might be written for v1.7.0 but I can tell you it's still relevant for usage in the latest Sequelize version (I have an actual server running with this design approach).
While your actual app's folder structure might be different due to Swagger's structure, but the way you use Sequelize within your app remains the same.
Related
I have seen multiple backends built with Nestjs and Serverless Framework, like the International Slackline Association's Rating's backend. While that is great on it's own, given the deployment speed improvements of serverless-components, I would really like to be able to use Nestjs and the Serverless express component together.
To me this seems a natural fit as NestJS ships with express as a default, and the express serverless component uses aws-serverless-express internally. But I did not find any proper guides on how to go about implementing them together. An issue exists on serverless component's github page for asking the same, but has no replies.
I'm looking to build a small customer management portal for myself. I've recently started working with node and vuejs a lot (coming from an html/css/javascript background). I've really enjoyed CLI development though and am looking to build a customer management portal (nothing fancy) that has a MySQL backend. After studying frameworks and ideas I found feathersjs which I REALLY like. After a few hours I was able to have a REST api that returns data from my MySQL database and uses authentication. I can get MySQL data in a JSON datasource and even do inserts, updates, deletes. I generated the services and models using the feathersjs CLI generator.
My question is, do I really need to make two separate projects (one for backend and one for a public frontend) and run them each on a node server? Or could I do this in as single project? I'm still learning and reading up on feathersjs but I'm not seeing a way to make this possible. I do see a public folder in my feathersjs project that was generated but I don't know how to utilize it for node (I wanted my frontend written in Vue). I can see how static HTMLfiles would work in this public folder.
I just found out about sails.js and i think it's really awesome. I want to build apps with sails and angular, but i haven't found any guides on doing this. I found this site which is supposed to have a talk on using sails.js instead on express in the mean stack, but there's not video there.
I would be glad for links to videos or blog posts on how to do this.
Thanks all.
This is getting downvoted because its not a direct question about code.
I have a boilerplate sailsjs app that you can use to model your own off of..
https://github.com/mikedevita/sailsjs-v10-angularjs-requirejs-boilerplate
This is based on v0.10 which is in beta right now, but the same concept applies.
I've created a simple yet powerful angular service, published as a bower component: https://github.com/diegopamio/angular-sails-bind
It basically:
Creates the model inside the $scope for you.
Retrieves the model data from the backend using socket.
Watches for changes made by the user in the UI and updates the backend immediately.
Watches for changes made in the backend and updates the UI immediately.
And it does it with just one line of code in your angular app, like this: $sailsBind("", $scope);
I made it as part of a personal project and then I decided to publish it as it could benefit others. It works with sails 0.10. Let me know if it suits your needs or if you'd like to see something else on it.
I am new to all three but I do know javascript well. I understand basics of them all but do not understand what the best way to implement the NodeJS server javascript with the express MVC and MongoDB database querys. I want to break up all this into their own files obviously but I am not sure how everything fits into the pre-created project template created by Express. Does anyone have a good solution or resource to share with me? Thank you
I recently started with node.js, express and mongodb myself and it's true the resources out there are mostly outdated. First of all, express is not an mvc framework. It has no opinion on the structure which you'll find out that it makes it so great. Your question is how to organise the code? It's clearly a personal preference but you can create a model folder where you can put your db queries for specific resources, your lib folder where you can establish a connection to your mongodb instance and call it wherever you need it and use the routes folder for your more specific needs like controllers on a traditional MVC. Another thing is that you have to decide how to interact with mongo. You can either use the native mongodb driver, perhaps with mongoskin as suggested, or mongoose for easier interactions such as defining schemas. Personally i prefer the native but it took me a while to get what it does and how it works. Finally for resources what i can suggest from personal experience and it's still my own opinion, is that the best thing you can do is buy the book Node.js in Action which was what made me realize what node.js is all about and how to use it. Hope it helps...
I am trying to build an application which both works as a SPA and as a normal application without re-writing any of the code as much as possible. My research has led to believe that this could be very possible using node + backbone (on both the server and client). I have found some resources on how to do this but nothing truly complete. Have anyone tried a full solution to re-using all the code?
The resources that I found:
Re-using backbone models on the server: http://blog.andyet.com/2011/feb/15/re-using-backbonejs-models-on-the-server-with-node/
Re-using backbone views and layout manager on the server:
http://vimeo.com/46033641
I have also found some frameworks that achieve this such as (bones, derby, meteor), but I dont feel like using such a framework is the best solution since I still want to have full control over backbone and node.
What you are trying to implement is Resource-View-Presenter model. Please read this article completely http://blog.nodejitsu.com/scaling-isomorphic-javascript-code. It provides much needed insight for isomorphic code that can execute both on the client and the server. It also helped me understand various models and architectures.
What backbone.js uses is traditional MVC framework, which cannot work on both client and server without modifications. So if you want to stick to backbone.js you will face this disadvantage sooner or later. I tried backbone too and found no easy way to do that.
I tried looking for RVP frameworks on node.js, but it is still new. I would suggest you look into flatiron.js http://flatironjs.org/. It is based on Resource-View-Presenter model, the only one I could find for node.js. Some changes will be required to implement on both server/client, but it is not much. You will find it is similar to backbone.
Hope it helps you to find the right path.
I recently did some research on the field and found some interesting projects that are using the same backbone code on the client and server (nodejs).
Project 1
The first one was introduced by Keith Norma from Groupon. He managed to reuse backbone router + templates on the client and server.
App demo: https://github.com/keithnorm/SpainJS-Pipedream-Demo
Presentation at SpainJS talk: http://www.youtube.com/watch?v=jbn9c_yfuoM
Project 2
The second project is Rendr presented by Spike Brehm from Airbnb but not released yet to the public. It seems a bit more ambitious as it also trades backbone model and collections to the nodejs server. You can read more about it here: http://nerds.airbnb.com/weve-launched-our-first-nodejs-app-to-product
UPDATE: Rendr code has been released: https://github.com/airbnb/rendr
Project 3
There is another project that also allows to share backbone code between client and server: https://github.com/developmentseed/bones