Make a project with postgresql and nodejs

javier lecca
2 min readNov 26, 2018

Hi guys,

In this moment i am working into a new project, the mission is work with postgresql and replace the actuall framework (loopback.js), them i suggested work to express.js.

I did a demonstration of how to work a project with postgresql and express.js

Lest’s go.

The architecture of the projects is the next:

app: In the app dir, you can make differents subdirs, each sub dir is a source or group of methods into the web service.

app/api: In this dir, we make the controller.js file, where we have the roots of the methods with their type method.

Too we have sample.js file, this file have the logic of the messenger smethod.

general: In the general dir, you can make differents files that you use around the project, is how the util dir. In this case we make the postgresql.js file, this file have the connection with us database.

routes: we define the root path to each group of methods.

.env: This file have all the variables of environment.

index.js: This file is the main file of the project, in this file you make the connection to release the project, and include the routes of the web services.

If anyone want the complete project, you can download the project in the next link.

Thanks for all, and give me a star in github 💪

--

--