The Wall App is an application where users can see awesome messages posted by the community members. The users can also register to the platform and start sharing their own thoughts on The Wall.
The Wall backend was built using NodeJS, a Javascript runtime engine that allows running Javascript outside the browser environment. It also uses the following tools:
- Express, a framework to easily create Rest API's;
- NodeMailer, library to send e-mails;
- Prisma, Object-Relational Mapper(ORM) to modeling and managing the database entities;
- Jest, a really powerful and easy to use testing framework;
- Husky, tool that enables, for instance, to setup the tests scripts to run every time new code is pushed to the remote repository.
Following the instructions down below you'll get a copy of the project, so you can run it from your local machine.
To run this project you must have:
-
NodeJS and Yarn installed on your machine. You can get these tools at https://nodejs.org and https://yarnpkg.com.
-
PostgreSQL installed on your computer.
-
Using the terminal, clone the repository to your local machine:
$ git clone https://github.com/FelipeTomazEC/wall-app-backend.git
-
Enter the directory of the project:
$ cd wall-app-backend
-
Install the dependencies:
$ yarn install
or$ yarn
-
Configure a PostgreSQL database for the application. You can use a tool like DBeaver for this.
-
Make a copy of the example.env file, and name it as .env:
$ cp example.env .env
-
Open the
.env
in an editor of your preference and edit the variables values. -
Run the db migrations using Prisma. This command will recreate the database schema for you:
$ npx prisma migrate dev
-
Build the project:
$ yarn build
-
That's all. Now you can run it with the command:
$ yarn start
Testing is a really important thing to be considered in software development. The Wall backend was build with this in mind, so it has tons of tests to make sure that the domain logic is working as expected. In order to run those tests, you can run $ yarn test
on the command line.
It's also possible to run the application on your local machine using Docker. In order to do that, you'll need Docker and Docker Compose installed. After installing these tools, do the following:
-
Make a copy of the example.env file, and name it as .env:
$ cp example.env .env
-
Open the
.env
in an editor of your preference and edit the variables values. -
Run Docker Compose command on the command line:
$ docker-compose up -d
-
That's it. The Wall API should be available on http://localhost:3000/.
P.S.: The 3000 is the PORT variable defined in .env file.