Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Restle is an incredibly lightweight (and unstable) RESTful API engine.
Restle currently supports properly sideloading data for Ember-Data. This framework is currently a side-project of mine, but I plan on extensively developing and testing it eventually, maybe. As of now, the framework should not be used for any serious applications. However, Restle has a near-zero learning curve, making it great for rapidly prototyping APIs.
$ npm install restle --save
$ npm install express --save
$ npm install mongoose --save
var mongoose = require('mongoose');
var express = require('express');
var app = express();
// Initialize Restle with modelsRootPath,
// i.e. the path where your models are defined.
var restle = require('restle')(app, {
modelsRootPath: __dirname + '/models'
});
// Connect to the database.
var url = 'mongodb://....';
mongoose.connect(url, options);
// Listen on some port.
app.listen(3000);
Restle expects models to be defined via proper folders:
/models/post/schema.js
/models/comment/schema.js
/models/user/schema.js
A schema is a simple exported object:
// /models/post/schema.js
module.exports.v1 = {
title: String,
comments: [{
ref: 'Comment'
}]
};
Note The above v1
is used to denote that this model is 'version one.' Multiple
verions currently do not work. Versioning will work eventually, but for now, you
must specify v1
when exporting the schema.
Schemas are identical to Mongoose Schemas except there is no need to specify
type: Schema.Types.ObjectId
when a ref: Model
syntax is found. The directory
structure above automatically routes:
GET /api/v1/posts
GET /api/v1/posts/:post_id
POST /api/v1/posts
PUT /api/v1/posts/:post_id
DELETE /api/v1/posts/:post_id
...
You cannot configure the API namespace yet, the default is /api/v1/
. I built this to work with Ember Data, so as of now, in order to POST
or PUT
something,
you must use the following syntax:
POST /api/v1/comments
{
"comment": {
"text": "I don't like you.",
"post": 164,
"user": 1451
}
}
PUT /api/v1/comments/213
{
"comment": {
"text": "Just kidding!"
}
}
My goals are to incorporate authentication, tasks, query overloading, and a lot more.
FAQs
JSON API engine.
The npm package restle receives a total of 0 weekly downloads. As such, restle popularity was classified as not popular.
We found that restle 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.