
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@goodly/mongoframework
Advanced tools
This API is designed to help companies identify the right people to contact at the right time to reduce the cost of unsuccessful product pitching
This is basic mongo express framework that uses a configuration file
to expose CRUD operations via a RESTful JSON API.
npm i @goodly/mongoframework
Create a config.js file in the root directory of the project and
add the code bellow.
module.exports = {
database: {
host: process.env.DB_HOST || '0.0.0.0',
port: process.env.DB_PORT || '27017',
name: process.env.DB_DATABASE || 'phonebook',
user: process.env.DB_USER || 'root',
password: process.env.DB_PASSWORD || 'password'
},
api: {
baseURL: '/api/v1',
port: process.env.API_PORT || '3000',
maxResponseSize: 50,
filters: {
pageNo: 'pageNo',
pageSize: 'pageSize',
sortBy: 'sortBy',
order: 'order'
}
},
endpoints: {
people: {
schema: {
table: 'people',
isEmbedded: false,
fields: {
name: {
type: 'string',
required: true
},
surname: {
type: 'string',
required: true
},
mobilenumber: {
type: 'mobile',
required: true
},
emailaddress: {
type: 'email',
required: true
}
}
},
http: {
get: ['', '/:id'],
post: [''],
patch: ['/:id'],
delete: ['/:id']
}
}
}
}
Crate a index.js file and copy and paste the code bellow
to expose the api on the desired port.
const app = require('@goodly/mongoframework').app
const config = require('@goodly/mongoframework').config
const http = require('http')
const port = Number.parseInt(config.api.port)
app.set('port', port)
const server = http.createServer(app)
const listen = () => {
console.log('Listening on port: '.concat(port))
}
server.on('listening', listen)
server.listen(port)
To run the api simply run the code bellow in the terminal
node index
All configuration is done in the config.js file. Create the file in
the root directory of your project. The file shoudl contain, database,
api and endpoint configuration. Paste the code bellow inside the your
config.js file and paste all other configs inside it.
Entry point code
modules.exports = {
}
Change the default values as required.
database: {
host: process.env.DB_HOST || '0.0.0.0',
port: process.env.DB_PORT || '27017',
name: process.env.DB_DATABASE || 'petstore',
user: process.env.DB_USER || 'root',
password: process.env.DB_PASSWORD || 'password'
}
Change the default values as required
api: {
baseURL: '/api/v1',
port: process.env.API_PORT || '3000',
filters: {
pageNo: 'pageNo',
pageSize: 'pageSize',
sortBy: 'sortBy',
order: 'order'
}
}
The endpoints property is used to describe the database tables and http
endpoints that expose the database via REST API. Endpoints has two
main properties shcema and http
endpoints: {
schema: {
},
http: {
}
}
The schema property is used to describe how each table (collection) will
store data.
schema: {
table: 'people',
isEmbedded: false,
fields: {
name: {
type: 'string',
required: true
},
surname: {
type: 'string',
required: true
},
mobilenumber: {
type: 'mobile',
required: true
},
emailaddress: {
type: 'email',
required: true
}
}
}
The table property is used to define the table (collection) name.
The isEmbedded property is used to define if a document is embedded in another.
If it is an embedded document use the table (collection) name of the parent document.
The fields property is used to define all the document properties and thier respective
types and if its required. Supported types are listed bellow.
type | Description | Supporting tags |
---|---|---|
string | all strings including an empty String | |
mobile | phone numbers | |
email address | ||
alpha | alphabet values only (a-z) | |
alphanumeric | alphabets and numbers (a-z) and (0-9) | |
date | javascript date values | |
int | integers | |
numeric | integers, doubles, floats | |
boolean | boolean values true and false | |
enum | one of a list of predefined value | list: [array] |
custom | support for regex based validation | regex: Regex |
The http property is used to define the available http methods and paths
relating to an entitiy. Supported methods are limited to GET, POST, PATCH, DELETE
http endpoint paths will append the endpoint name to the begining of the path,
so no need to explicitly define the enpoint name. So the people paths will be
configured as.
http: {
get: ['', '/:id'],
post: [''],
patch: ['/:id'],
delete: ['/:id']
}
Which will result in these endpoints
The framework uses express under the hood and exposes the express
object as app. Which you can use to plugin standard express middlware
to do things that the api does not provide pre and post request.
FAQs
This API is designed to help companies identify the right people to contact at the right time to reduce the cost of unsuccessful product pitching
We found that @goodly/mongoframework 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.