1.0.6 • Published 6 years ago
rest-api-constructor v1.0.6
REST-API-constructor
a helpful constructor for REST APIs using Express, CORS, body-parser, and Mongoose.
I did not create Express, CORS, body-parser, or Mongoose. Full credit to their respective developers.
to install the constructor use :
npm install --save rest-api-constructor
example usage :
const API = require('REST-API-constructor');
let test = new API(/* see route name */, /* see schema */, /* see port */, /* see db */);
see 'example-app.js'
route name :
the API constructor will create 5 routes with the route name. :
app.get('/test', ...)
app.get('/test/:id', ...)
app.post('/test', ...)
app.put('/test/:id', ...)
app.delete('/test/:id', ...)
schema :
this is just a basic schema, the constructor will convert it into a mongoose schema. :
let schema = {
fname: String,
lname: String
}