My Javascript Project

npm i -g create-js-projectyarn global add create-js-project
create-js-project iAtlas-frontendiAtlas-frontend
? Choose a template: 
❯ Browser
──────────────
Express Static Server
Express HTTP Server
Express + React
Express + React + Redux
Node.js Static Server
git init
git status
git add .
git commit -m “initial commit”

…or push an existing repository from the command line

git remote add origin https://github.com/UserName/ProjectName.git
git branch -M main
git push -u origin main
My final models will be:
User:
NameCountry:
Name
Continent
Capital
Religion
Language
Map
country_idCity:
Location
Population
Crime
School
Image
city_id
rails new iAtlas-backend — api — database=postgresql
git status
git add .
git commit -m "initial commit"
git remote add origin https://github.com/username/projectname.git
git branch -M main
git push -u origin main
rails g resource Country continent name capital religion language image_url
rails db:create
rails db:migrate
Country.create(name: “Algeria”, continent: “Africa” , capital: “Algiers”, religion: “Islam”, language: “Arabic”, image_url: “https://cdn.britannica.com/78/183578-050-61050E24/World-Data-Locator-Map-Algeria.jpg")puts “Seeded!”
rails db:seed
rails s
http://localhost:3000/countries
Unknown action
The action ‘index’ could not be found for CountriesController
def index
countries = Country.all
render json: countries
end
// http://localhost:3000/countries
[
{
“id”: 1,
“continent”: “Asia”,
“name”: “Afghanistan”,
“capital”: “Kabul”,
“religion”: “Islam”,
“language”: “Pashto”,
“image_url”: “https://cdn.britannica.com/76/183576-050-FC2A06E2/World-Data-Locator-Map-Afghanistan.jpg",
“created_at”: “2021–09–05T04:36:44.812Z”,
“updated_at”: “2021–09–05T04:36:44.812Z”
},
gem ‘active_model_serializers’, ‘~> 0.10.0’
bundle install
rails g serializer Country
class CountrySerializer < ActiveModel::Serializer
attributes :id, :continent, :name, :capital, :religion, :language, :image_url
end
// http://localhost:3000/countries
[
{
“id”: 1,
“continent”: “Asia”,
“name”: “Afghanistan”,
“capital”: “Kabul”,
“religion”: “Islam”,
“language”: “Pashto”,
“image_url”: “https://cdn.britannica.com/76/183576-050-FC2A06E2/World-Data-Locator-Map-Afghanistan.jpg",
},
ActiveModelSerializers.config.key_transform = :camel_lower

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to set up code coverage for cypress

Keys, Values & Entries — Object

Looking forward by looking back

5 Best Practices to Choosing Third-Party NPM Packages

The State Management of JavaScript

Angular 9 new features

Creating a Web load/Performance agent on Google Cloud

NFT- Weekly Digest | Week 06

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fernando Hidalgo

Fernando Hidalgo

More from Medium

Phase 1: JavaScript

Fulfilling, Frustrating, JavaScript

How Javascript works

JavaScript Project