Skip to content

YuriAbgaryan/example-node-postgres

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Simple API with Node Postgres + Restify

Simple Example API Rest, using Node, restify, PostgreSQL, Docker and docker-compose.

Getting Started 🚀

First we'll clone the project.

$ git clone https://github.com/gustafsilva/example-node-postgres.git

Open the project and install node dependencies.

$ cd example-node-postgres
$ npm install

Run the database in the container.

$ cd postgres
$ docker-compose up -d

Go back to the initial project folder and run the restify server.

$ cd ../
$ npm start

Ready! 👍 You can already hack the project. 😎

Dependencies

Debugging project

Some lines of the projects are commented (usually of logs), you can withdraw the comment to facilitate the debug in the terminal.

You can also run the project in development mode (using nodemode to capture changes on the server) with the command:

$ npm run start-dev

Tests

To run the tests, make sure the database server is running and run the command:

$ npm test

Jest and supertests were used to automate the tests. ❤️

Automated commands 🔥

List of commands that can by using npm:

  $ npm install # install all node dependecies
  $ npm start # start server
  $ npm run start-dev # start development mode server (any change restarts the server)
  $ npm test # perfoms all the tests 
  $ npm run generate-docs # generates html documentation
  $ npm run clean-docs # remove html documentation
  $ npm run clean # remove documentation in thtml and modules node

Documentation

You can access the documentation here. Or you can generate locally using the command:

$ npm run generate-docs

Just open the docs/index.html file in your browser and start browsing... 📗

jsdoc was used for document automation. ❤️

More informations

Single entity of the database:

Contribution

If you have found an error or want to improve the example, create an issue or pull request.

Licence

The contents of this repository are covered under the MIT License.

About

Simple example node and the node-postgres collection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%