rest-api-test is a NodeJS Rest Api based on Restify and Mongoose.
Here you will manage a pet shop with some basic requests :
{
type: {type: String, required: true},
name: {type: String, required: true},
age: {type: Number, required: true},
picture: {type: String, required: true}
}example:
{
type: 'dog',
name: 'Luffy',
age: 2,
picture: 'http://www.picture.com/2'
}List all animals and paginate:
- method:
GET - path:
/animals - param:
?page=2
Show one specific animal from his id:
- method:
GET - path:
/animals/:id
Insert one (or many) animals:
- method:
POST - path:
/animals/
Update an animal:
- method:
PUT - path:
/animals/:id
delete an animal:
- method:
DELETE - path:
/animals/:id
npm install
Create a .env file at the root and add:
DB_PATH=1234.exempleDB.com:port/yourbase
DB_USER=DBuser
DB_PWD=DBpassword
npm start
The application is tested with Jest. To launch the tests:
npm run test
The application can be build and run with Docker:
docker build -t appName .
docker run -d -p 8080:1337 --name appName -e DBPATH=1234.exempleDB.com:port/yourbase -e DB_USER=user -e DB_PWD=password appName
StandardJS with ESLint