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.
caminte-generator
Advanced tools
Readme
Fast, unopinionated, minimalist restful server for node and express based on caminte orm.
mysql, sqlite3, postgres, mongodb, redis, riak, couchdb(nano), rethinkdb, tingodb
$ npm install -g caminte-generator
The quickest way to get started with caminte-generator is to utilize the executable cjs(1)
to generate an application as shown below:
Create the app:
$ npm install -g caminte-generator
$ cjs -i test && cd ./test
Install dependencies:
$ npm install
Edit ./config/index.js
file, to configure the connection to the database server.
Create model:
$ cjs -g User name email password desciption:text created:date
Run server:
$ cjs -s
Create User:
$ curl -X POST http://localhost:3000/api/users -i -H "Content-type: application/json" -d "{\"name\":\"Alex Gora\",\"created\":\"2014-01-01\"}"
# or
$ curl -X POST http://localhost:3000/api/users -i -d "name=Alex%20Gora&created=2014-01-01"
Update User:
$ curl -X PUT http://localhost:3000/api/users/1 -i -H "Content-type: application/json" -d "{\"pass\":\"6r87uyfGFTg\",\"email\":\"example@example.com\"}"
# or
$ curl -X PUT http://localhost:3000/api/users/1 -i -d "pass=6r87uyfGFTg&email=example@example.com"
Get Users:
$ curl -X GET http://localhost:3000/api/users -i -H "Content-type: application/json" -d "{\"skip\":\"0\",\"limit\":\"10\",\"sort\":\"id:desc\"}"
# or
$ curl -X GET http://localhost:3000/api/users -i -d "skip=0&limit=10&sort=id:desc"
Delete User:
$ curl -X DELETE http://localhost:3000/api/users/1 -i
Search:
$ curl -X GET http://localhost:3000/api/users -i -H "Content-type: application/json" -d "{\"search\":\"name:alex\"}"
# or
$ curl -X GET http://localhost:3000/api/users -i -d "search=name:alex"
$ cjs [options] [dir]
-h, --help output usage information
-V, --version output the version number
-i, --init <appname> create caminte application
-p, --prefix <prefix> api url prefix defaults v1
-g, --generate <modelname] generate data model
-s, --server runs caminte server
-a, --adapter database adapter (mysql|redis|etc...)
-j, --jade add jade engine support (defaults to ejs)
-H, --hogan add hogan.js engine support
-c, --css <engine> add css <engine> support (less|stylus|compass) (defaults to plain css)
-f, --force force on non-empty directory
# create new restful application
$ cjs -i Test -a mysql -j
# create model
$ cjs -g Post active:bool name:string desc:text created:date
will provide the following routes:
method route action
------------------------------------------------------------
GET /api/:table index
GET /api/:table/:id show
POST /api/:table create
PUT /api/:table/:id update
DELETE /api/:table/:id destroy
DELETE /api/:table destroyall
On initialization directories tree generated, like that:
.
|-- bin
| `-- www
|-- config
| `-- index.js
|-- lib
| |-- inflection.js
| |-- tools.js
| `-- xml.js
|-- models
| `-- User.js
|-- public
| |-- css
| | `-- ...
| |-- js
| | `-- ...
| `-- img
| `-- ...
|-- test
| |-- routes
| | `-- ...
| |-- models
| | `-- ...
| `-- units
| `-- ...
|-- app.js
`-- package.json
(The MIT License)
Copyright (c) 2014 Aleksej Gordejev <aleksej@gordejev.lv>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
RestFul application generator based on CaminteJS ORM
The npm package caminte-generator receives a total of 16 weekly downloads. As such, caminte-generator popularity was classified as not popular.
We found that caminte-generator 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.