Create a basic CRUD with an simple API Rest from scratch without using any framework but express.js
Base Camping Model:
- name
- phone
- address
- location: { lat, lon}
Backend:
Create, read, modify and delete registers on camping’s model. Use at least the following technology:
Frontend:
Create a frontend app that communicates with the previously generated API rest Basic functionality is creating a reports, search, append, delete and edit.
Use at least the following technology:
Bonus Point:
Use any database (preferable mongodb) as a persistence layer. Create a frontend production model using Gulp automation an http://pugjs.org/ technology. Unit and functional testing.
- MongoDB service up and running.
- Node 6.9
- NPM
-
Clone repository
-
$ npm install
-
$ npm start
-
$ casperjs test e2e/casperjs_tests/test-suite.js
-
Manual rebuild (needs Angular CLI installed globally) -> $ ng build
- Unit tests: I've been able to setup the environment with a few "out of the box" test working but I've not been able to code my own unit tests. The main problem has been to mock a service method that returns an observable.
- Exercise required to use Gulp: I didn't use it since Angular-CLI solves many of Gulp's goals.
- I've Never used ExpressJS before but seems to be a minimal/robust tool to work with.
- Never worked with NoSQL databases, just a few 'hello world' with a NoSQL database cloud service called 'Firebase'.
- Installed a Firefox addon -> RESTClient. Interesting tool to make test requests.
- Discovered mongoose. A node dependency to ease modelling under ExpressJS.
- Discovered node-restful. An auxiliar tool to build and API using ExpressJS and mongoose.
- I've Never used Angular-CLI before: Accelerates production, absolutely useful!
- Added Twitter Bootsrap for Layout styling into the Angular build.
- The frontend side is an Angular2 SPA made of
- 3 Components: App (main), Topbar and Crud.
- 1 Model: Camping
- 1 Service: ApiService.
- Did not have time to workout the performance (minification, tree shaking)
- Could not setup commit hook on linter to keep well formed code.
- A couple of E2E tests under CasperJS (need special conf under Win, environtment vars).