Repositorio usado para realizar la práctica del tercer módulo del bootcamp -> NodeJS
- MondoDB: To start a local server execute
mongod --dbpath='/home/grusite/data/db'
- To init the DB execute
npm run installDB
- To start the server execute
npm run dev
- To execute linter in all files
npm run linter
- To start the server with the DB formated and the linter
npm run initDB-dev
- models -> where I store the DB model
- controllers -> where I store the route controllers
- lib -> where I store somo db functions
- public -> all necesary to interact with frontal made by EJS
http://localhost:3000/apiv1/anuncios
With no parameters, it will return all advertisement aditionally, you can add any filter in the URL:
start: numeric. Skip the number given in the result returned limit: numeric. Limits the number of results returned fields: string. Selects the fields especified in the query sort: string. Sorts the query by the criteria given in the query name: string. Returns the ads that starts with the name given tag: string. Returns the ads with the tags given solg: string. Returns the ads if it for sold or to buy price: string. Returns the ads with the filter given in price
http://localhost:3000/apiv1/anuncios/:id
http://localhost:3000/apiv1/anuncios/
data { name: "name", sold: true|false, price: number, picture: path, tags: tags }
http://localhost:3000/apiv1/anuncios/:id
dataToUpdate { name: "name", sold: true|false, price: number, picture: path, tags: tags }