This project was bootstrapped with React-Rails. The backend was generated by Ruby On Rails template Generation.
After creation, your project should look like this:
Project/
app/
bin/
config/
db/
lib/
public/
spec/
vendor/
Gemfile
package.json
README.md
Before installing, please make sure to have global installations of
- node v8 or higher
- npm v6 or higher
- PostgreSQL (if running a local DB instance)
- Ruby On Rails ([email protected] & [email protected])
- Execute
bundle install && npm install
to configure the local environment. - Compile webpack dependencies via
rails webpacker:compile
- Update the DB configuration in
config/database.yml
- Perform DB initialization/migration and seeding
$ rails db:create
$ rails db:migrate
$ rails db:seed
- Start the development server
rails s
This application uses npm and rails scripts for testing, development, and deployment.
$ rails s
: run the development version of the app$ rails s -e production
: run the production version of the app$ rails db:create
: perform DB initialization$ rails db:migrate
: perform DB migrations$ rails db:seed
: perform DB seeding$ rspec
: run BE tests$ rubocop
: perform linting of the BE code$ npm run lint
: perform linting of the FE code
This endpoint creates a new Post with current user as author. An example of the payload (input data) is provided below:
body: {
content: Text, /* required */
title : String /* required */
}
The output echos back the provided data with the system-generated record ID:
let response = {
statusCode: 200,
body: {
id : Number, /* required */
author : String, /* required */
content: Text, /* required */
title : String /* required */
}
This endpoint returns the complete set of available Posts. No input data is required The output is provided in array with each object having the structure described above:
let response = {
statusCode: 200,
body: [
Post1,
Post2,
...
PostN
]
}
This endpoint returns an individual Post by ID. The ID is provided as a URI parameter.
The output is the same as from POST /api/post
This endpoint updates an existing Post by ID. The input/output formats are the same as in POST /api/post
This endpoint deletes an individual Post by ID. The ID is provided as a URI parameter.