Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
dao2express
Advanced tools
Readme
Automatic generated APIs are great. I am a big fan of projects like JSON-server and sails.js. The intend for this project is to set the express development first.
On the other hand, I strongly believe in dao modules or some kind of data source definition with common interface. Modules that access each a single collection on a database and provides standard methods to retrieve data from that resource.
In first place, this project is designed to use daos prepared by tmysqlpromisedao and tmongodao, a library to provide dao-modules to access the mysql and mongo database. But it is of course easy to implement a dao by hand, with custom logic.
Utilizing these conventions dao2express can provide a RESTful API not just for mysql but also for any other data resource that can be accessed through a dao.
var app = new Express();
app.use('/user', dao2express(daos.userDao));
The generated API provides the following endpoints
GET / - list all using the dao's getAll methods
the value need to be higher (alphabetic, numbers, dates)
GET /:id - retrieve a single item by Id using the daos getById method.
POST / to create a new entry in the collection.
uses the daos insert method to add a new item to the table.
the items properties can be send using post or the URLs querystring
PUT /:id/ - to update an item
uses the daos save method to update an entry of the table.
the properties can be send using post or querystring
DELETE /:id to remove an item from the collection.
Providing an API which is as powerful as very risky, but this API generator is meant to be used in production. So there are several ways to implement authentication validation and trigger further methods like logging clearing related data, adding statistics and/or handle de-normalization.
Using dap2express, you have two ways to change the generated API. One way is the direct way, as you would do it with any express middleware. Handle the route before the API is utilized. Add logging and general authentication, in fact anything you could imagine. Or implement yourself.
The second is for convenience. By passing an options object as second parameter to the daoToRestRouter - method. The options are:
Now it is time to implement some cool application using - tasyncexpress to use modern Javascript with async await. - tmysqlpromisedao to implement a standard way for data access in your application. - tmongodao to implement a standard way for data access in your application. - and now dao2express to get your API up and running as fast as you can and focus.
Tobias Nickel, German Software Engineer and Tech Lead located in Shanghai.
FAQs
dao for mongodb
The npm package dao2express receives a total of 2 weekly downloads. As such, dao2express popularity was classified as not popular.
We found that dao2express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.