Using Fedora to implement REST API in JavaScript: part 2
In part 1 previously, you saw how to quickly create a simple API service using Fedora Workstation, Express, and JavaScript. This article shows you the simplicity of how to create a new API. This part shows you how to:
Install a DB server
Build a new route
Connect a new datasource
Use Fedora terminal to send and receive data
Generating an app
Please refer to the previous article for more details. But to make things simple, change to your work directory and generate an app skeleton.
$ cd our-work-directory
$ npx express-generator –no-view –git /myApp
$ cd myApp
$ npm i
Installing a database server
In this part, we’ll install MariaDB database. MariaDB is the Fedora default database.
$ dnf module list mariadb | sort -u ## lists the streams available
$ sudo dnf module install mariadb:10.3 ##10.4 is the latest
Note: the default profile is mariadb/server.
For those who need to spin up a Docker container a ready made container with Fedora 31 is available.
If you’d like the service to start at boot, you can also enable it in systemd:
$ sudo systemctl enable mariadb ## start at boot
Next, setup the database as needed:
$ mysql -u root -p ## root password is blank
MariaDB> CREATE DATABASE users;
MariaDB> create user dbuser identified by ‘123456‘;
MariaDB> grant select, insert, update, create, drop on users.* to dbuser;
MariaDB> show grants for dbuser;
MariaDB> \q
A database connector is needed to use the database with Node.js.
We’ll leverage Sequelize in this sample API. Sequelize is a promise-based Node.js ORM (Object Relational Mapper) for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.
$ npm install sequelize ## installs Sequelize
Connecting a new datasource
Now, create a new db folder and create a new file sequelize.js there:
Let‘s create a new file models/user.js. A nice feature of a Sequelize model is that it helps us to create the necessary tables and colums automatically. The code snippet responsible for doing this is seen below:
sequelize.sync({
force: false
})
Note: never switch to true with a production database – it would drop your tables at app start!
We will refer to the earlier created sequelize.js this way:
const sequelize = require('../db/sequelize')
Building new routes
Next, you’ll create a new file routes/user.js. You already have routes/users.js from the previous article. You can copy and paste the code in and proceed with editing it.
You’ll also need a reference to the previously created model.
const User = require('../models/user')
Change the route path to /users and also create a new post method route.
Mind the async – await keywords there. An interaction with a database will take some time and this one will do the trick. Yes, an async function returns a promise and this one makes promises easy to use.
Note: This code is not production ready, since it would also need to include an authentication feature.
The console output of the curl command is a JSON array containing data of all the records in the Users table.
Note: This is not really the usual end result — an application consumes the API finally. The API will usually also have endpoints to update and remove data.
More automation
Let‘s assume we might want to create an API serving many tables. It‘s possible and very handy to automatically generate models for Sequelize from our database. Sequelize-auto will do the heavy lifting for us. The resulting files (models.js) would be placed and imported within the /models directory.
$ npm install sequelize-auto
A node.js connector is needed to use this one and we have it already installed for MariaDB.
Conclusion
It‘s possible to develop and run an API using Fedora, Fedora default MariaDB, JavaScript and efficiently develop a solution like with a noSQL database. For those used to working with MongoDB or a similar noSQL database, Fedora and MariaDB are important open-source enablers.
Square Enix Shares Tomb Raider Outfits For Animal Crossing: New Horizons
If you’re a keen Animal Crossing: New Horizons player who just so happens to love all things Tomb Raider, these custom Lara Croft designs are a must-have.
Square Enix has shared three designs in total, inspired by Lara’s ‘Classic’, Angel of Darkness and Tomb Raider (2013) appearances. You can easily get your hands on each design by heading to the Able Sisters shop and entering the creator code MA-5858-0335-8877 at the Custom Design machine at the back.
If you’d rather have a go at making your own Lara-inspired outfits from the clothes you can purchase in-game, the official Tomb Raider blog also has some tips for you. Why not have a go at recreating these?
Young Lara: Fishing Vest (Avocado), Explorer Shorts (Avocado), Trekking Shoes (Brown). Bonus – pose with that slingshot!
Rise of the Tomb Raider (Siberia): Mountain Parka (Red), Slacks (Beige), Knit Hat (Gray), Boots (Black)
Looking for more amazing custom designs? There are plenty more where these came from, including looks inspired by Pokémon, Zelda, Mario and more.
Gamescom Confirms Its Dates And Opening Night Live Showcase Event
Gamescom has moved to an all-digital event in the wake of coronavirus concerns, and as a result the show is getting a slight date shift. Previously scheduled to take place August 25-29, the new digital event will instead be held August 27-30. That also shifts the date for the Opening Night Live event held by Geoff Keighley, which will now be August 27.
According to the announcement, Gamescom will now serve as a "content hub" for news and publisher events. Unlike the standard Gamescom, the digital event won't require a ticket since the events will be streaming. Opening Night Live will kick off the show, in addition to some other special events like Gamescom: Awesome Indies and Gamescom: Daily Show. The event will culminate in the August 30 presentation of Best of Show.
The annual Devcom conference will take place August 17-30, running partly concurrently with Gamescom.
If You Love Doodle God…Embrace Your Dark Side with Doodle Devil!
[freebies.indiegala.com] The same addictive, puzzle game play that made Doodle God a hit is back but with an evil twist. Being bad has never been so much fun & free!
Disintegration: Now Available for Pre-Order on Xbox One
Disintegration is a sci-fi, first-person shooter blended with real-time tactical strategy created by a small independent studio of 30+ industry veterans and new talent founded by Marcus Lehto, the co-creator of Halo.
Set in the near future Earth, humanity has developed a process to survive the harsh realities left by a world ripped apart by famine and limited resources where the human brain is transferred to a robotic armature. This process is known as Integration.
In the Disintegration single-player campaign, you play as Romer Shoal, an Integrated Outlaw. Romer was previously an incredibly skilled Gravcycle pilot who now finds himself leading a small band of Integrated Outlaws seeking to reclaim their lost humanity. Venture with your crew to defeat Black Shuck, a villainous Integrated who will stop at nothing to end humankind. Eliminate his domineering Rayonne forces to save what’s left of and reboot humanity. Follow Romer’s story as you control heavily weaponized Gravcycles and lead your team through a series of diverse missions packed with adventure, explosions, and plot twists.
Play five versus five online competitive in Disintegration multiplayer. There will be nine crews at launch, each with a unique playstyle from weaponry, durability, speed, to your ground unit’s abilities. There are three action packed modes to choose from—Zone Control, Retrieval, and Collector—each with beautiful maps. Customize your loadout with epic Gravcycle skins, playful emotes, animated banners, and many more!
Disintegration is available for pre-order now on the Microsoft Store and set to launch worldwide on June 16, 2020! Players who pre-order the game will receive bonus cosmetic digital content for multiplayer, including a unique Lost Ronin Midnight crew skin, Flex emote, and a Disintegration Medal Gravcycle attachment. Those who pre-order on Xbox One will acquire the Elite Disintegration banner.
Disintegration
Private Division
☆☆☆☆☆
★★★★★
Preorder and receive bonus cosmetic items: • Lost Ronin “Midnight”: Take your enemies by surprise with the exclusive “Midnight“ skin for Lost Ronin. • Flex: Flex on your opponents with the exclusive “Flex” emote. • Disintegration Medal: Showcase your dedication to the cause with the Disintegration medal • Elite Disintegration: Show everyone how you roll with the Elite Disintegration animated banner. From V1 Interactive, the new 30-person independent development studio founded by Marcus Lehto, the co-creator of Halo, comes Disintegration, a sci-fi first-person shooter combining FPS and real time strategy elements. Set in the near future on Earth, the only hope for human survival is through Integration, a process developed to preserve human brains in robotic armatures. You play as Romer Shoal, a former Gravcycle pilot in command of a small resistance force still grasping onto the fading memories of their human selves. With the domineering Rayonne forces set on eliminating the final remnants of human society, it’s up to Romer and his crew of Outlaws to fight back and reboot humanity. Pilot a variety of weaponized Gravcycles and command your crew on the ground by leveraging a variety of unique unit abilities and mastery of your own personal arsenal to dominate the battle. In addition to the thrilling single-player campaign, Disintegration features frenetic PvP multiplayer where pilots and their crews compete in three exciting game modes across a variety of maps. Key Features: • Tactical Gravcycle combat: Pilot a heavily armed Gravcycle featuring a variety of firepower, maneuverability, and abilities. Also command your crew on the ground, directing them to attack targets, pick up items, and use their unique abilities to turn the tide in battle. • Riveting single-player campaign: From Marcus Lehto, the co-creator of Halo and creative director of Halo: Reach, comes an all-new sci-fi saga. Play as Romer Shoal and confront the Rayonne, a rising global army set on eliminating what remains of humanity. • Frenetic multiplayer action: Battle across a variety of maps in three intense, team-based 5v5 multiplayer modes. Choose your favorite Gravcycle and lead your crew alongside your teammates, competing against opposing pilots to win objective-based matches. • Customize your crews: Each multiplayer crew has their own individual look and personality, along with different skillsets and playstyles. Master your favorite crew and customize your experience with a variety of skins, banners, badges, and emotes.
Blog: How Niantic’s response to COVID-19 has protected Pokemon GO
The following blog post, unless otherwise noted, was written by a member of Gamasutras community. The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.
Pokémon GO tends to perform in peaks and troughs, which reflects in the update cycles of the game. According to Priori Data, it saw a decline of 19.61% in net revenue in 1Q20, compared with 4Q19, across Apple App Store and Google Play combined. This is not unusual for the first quarter, given seasonality and the high consumer spending associated with the fourth quarter across most markets. Pokémon GO had a similar net revenue decline of 22.8% in 1Q19 versus 4Q18.
In fact, the game appears largely untouched by the COVID-19-induced lockdown so far, with healthy net revenue and continuous growth throughout 1Q20. What’s more, the game hit peak monthly active users (MAUs) for the year so far in March, at 16.9m, which suggests that users are increasingly unfazed by quarantine regulations. Despite a marginal dip in April, net revenue is set to reach its 2020 peak in May at just shy of $50m.
In early March, Niantic announced changes to its location-based AR games, including PokémonGO and Wizards Unite, which would make them easier to play from home. For Pokémon GO, these measures included:
Distances needed to walk to hatch an egg were halved, Pokéstops dropped gifts more frequently, and the wild Pokémon spawn rate was increased
Players could purchase Pokémon-attracting incense more cheaply, and it would last for twice as long
The PvP feature Go Battle League no longer required players to walk, or pay, to enter
Players could organise their own tournaments without needing to physically scan each other’s QR codes
If any game category was at risk from the COVID-19 pandemic, it was the location-based AR genre. This demonstrates the importance of flexibility, and of responding quickly to potentially game-changing events. User engagement with the games sector more broadly has benefitted considerably from lockdown.
The US and Japan are the most substantial markets for Pokémon GO, with the combined territories accounting for 65% of app store net revenue in 1Q20. The virus only started gaining traction in these countries later in the quarter. As a result, the measures taken to enable at-home play will likely offset any notable decline in engagement through 2Q20.
Based in Leamington Spa, Lab42 has worked on a wide range of projects for clients like Sega Publishing Europe, Klei Entertainment, Aspyr, and Ripstone, including titles such as Yakuza 0, Sonic Mania, and Terratech.
The studio also holds the exclusive license to the World Snooker Tour brand, and was the sole-developer on sports sim Snooker 19.
Sumo already owns a number of studios including Everybody’s Gone to the Rapture developer The Chinese Room, LittleBigPlanet 3 maker Sumo Digital, and God of War: Remastered co-developer Red Kite Games.
It explained the addition of Lab42 will strengthen its presence in Leamington Spa, where Sumo Digital currently has an office, while also bolstering its development team.
“The opportunity to buy Lab42, a business that is highly respected in the industry and well known to key members of our team, was both timely and compelling,” commented Sumo Group chief exec Carl Cavers.
“The addition of a 29 strong, established, proven and talented team will help keep our organic growth ambitions on track, through the COVID-19 pandemic, which, as previously reported, has created some recruitment challenges.”
Posted by: xSicKxBot - 05-18-2020, 03:10 PM - Forum: Windows
- No Replies
FedEx and Microsoft join forces to transform commerce
Companies to collaborate to reinvent the end-to-end commerce experience globally; FedEx Surround announced today as first solution
MEMPHIS, Tenn., and REDMOND, Wash. — May 18, 2020 — FedEx Corp. (NYSE: FDX) and Microsoft Corp. (Nasdaq: MSFT) on Monday announced a new multiyear collaboration to help transform commerce by combining the global digital and logistics network of FedEx with the power of Microsoft’s intelligent cloud. Together, FedEx and Microsoft aim to create opportunities for their customers through multiple joint offerings powered by Azure and Dynamics 365 that will use data and analytics solutions to reinvent the most critical aspects of the commerce experience and enable businesses to better compete in today’s increasingly digital landscape.
“FedEx has been reimagining the supply chain since our first day of operation, and we are taking it to a new level with today’s announcement,” said Frederick W. Smith, chairman and CEO, FedEx. “Together with Microsoft, we will combine the immense power of technology with the vast scale of our infrastructure to help revolutionize commerce and create a network for what’s next for our customers.”
This new strategic alliance represents a long-term commitment between the companies to fuel innovation, collaborate on product development and share subject-matter expertise. Today, FedEx networks link more than 99% of the world’s gross domestic product across 220 countries and territories, and Microsoft Azure is trusted by more than 95% of Fortune 500 companies. By combining the breadth and scale of the FedEx network and the Microsoft cloud, businesses will have an unprecedented level of control and insight into the global movement of goods.
“Now more than ever, organizations are counting on an efficient and capable supply chain to remain competitive and open for business,” said Satya Nadella, CEO, Microsoft. “Together with FedEx, we will apply the power of Azure, Dynamics 365 and their AI capabilities to this urgent need, building new commerce experiences that transform logistics for our mutual customers around the world.”
Announcing FedEx Surround — driving digital illumination of the physical world
FedEx Surround, the first solution resulting from the FedEx and Microsoft collaboration, allows any business to enhance visibility into its supply chain by leveraging data to provide near-real-time analytics into shipment tracking, which will drive more precise logistics and inventory management. While most carriers are reactive to global logistics dynamics with limited visibility options built into a package’s journey, FedEx Surround will provide near-real-time insights — down to the granular level of ZIP code, for example — to shine a digital light on the progress and movement of physical inventory.
The benefits offered by FedEx Surround will extend to any business with a supply chain and particularly those that depend on highly time-sensitive deliveries. For example, a hospital may urgently need a package to help save a life, or a part may need rapid transport to a manufacturing facility to avoid an operational shutdown. In each instance, the near-real-time data insights provided by FedEx Surround offer a significant advantage to not only the organizations using the platform but also the people they serve.
FedEx Surround can also collect multiple data points gathered through the enhanced scanning and proprietary IoT technology of FedEx and analyze them using Microsoft’s broad suite of AI, machine learning and analytics solutions. This will provide participating businesses with not only enhanced visibility of a package’s location during its journey, but also knowledge of global commerce conditions and external challenges in near-real-time, such as severe weather or natural disasters, mechanical delays, clearance issues, and incorrect addresses. This unprecedented level of data-driven insight will give FedEx Surround customers the opportunity to intervene early and act to avoid logistical slowdowns before they occur to reduce friction and costs. And with every package that ships, FedEx Surround will analyze past trends to identify future opportunities for streamlined shipping, creating a stronger and more resilient commercial ecosystem.
Information regarding FedEx Surround availability will be shared beginning this summer, and customer access will be rolled out in the months ahead.
FedEx and Microsoft expect to announce additional solutions as part of their collaboration in the coming months, which will leverage even more Microsoft technologies, including Dynamics 365. This includes reimagining commerce experiences for businesses to offer consumers more integrated ways to shop, and faster and more efficient deliveries.
Those interested in more details, including visual assets, should visit www.fedex.com/transform.
About FedEx Corp.
FedEx Corp. (NYSE: FDX) provides customers and businesses worldwide with a broad portfolio of transportation, e-commerce and business services. With annual revenues of $70 billion, the company offers integrated business solutions through operating companies competing collectively and managed collaboratively, under the respected FedEx brand. Consistently ranked among the world’s most admired and trusted employers, FedEx inspires its more than 475,000 team members to remain focused on safety, the highest ethical and professional standards and the needs of their customers and communities. To learn more about how FedEx connects people and possibilities around the world, please visit about.fedex.com.
About Microsoft
Microsoft (Nasdaq “MSFT” @microsoft) enables digital transformation for the era of an intelligent cloud and an intelligent edge. Its mission is to empower every person and every organization on the planet to achieve more.
For more information, press only:
Microsoft Media Relations, WE Communications for Microsoft, (425) 638-7777, rrt@we-worldwide.com
Note to editors: For more information, news and perspectives from Microsoft, please visit the Microsoft News Center at http://news.microsoft.com. Web links, telephone numbers and titles were correct at time of publication, but may have changed. For additional assistance, journalists and analysts may contact Microsoft’s Rapid Response Team or other appropriate contacts listed at https://news.microsoft.com/microsoft-public-relations-contacts.
Forward-Looking Statements
Certain statements in this press release may be considered forward-looking statements, such as statements relating to FedEx and Microsoft managements’ views with respect to future events and financial performance. Forward-looking statements include those preceded by, followed by or that include the words “will,” “may,” “could,” “would,” “should,” “believes,” “expects,” “anticipates,” “plans,” “estimates,” “targets,” “projects,” “intends” or similar expressions. Such forward-looking statements are subject to risks, uncertainties and other factors which could cause actual results to differ materially from historical experience or from future results expressed or implied by such forward-looking statements. Potential risks and uncertainties include, but are not limited to, the rate of future e-commerce growth and our ability to successfully compete in the e-commerce market, our ability to successfully introduce e-commerce solutions in the expected time frame, customer acceptance of the FedEx Surround platform and other factors which can be found in FedEx Corp.’s and Microsoft’s respective press releases and filings with the Securities and Exchange Commission. Any forward-looking statement speaks only as of the date on which it is made. FedEx and Microsoft do not undertake or assume any obligation to update or revise any forward-looking statement, whether as a result of new information, future events or otherwise.
Indie World Showcase Star Liberated Scores June Release Date On Switch
We’ve got our hands on a brand new trailer for Liberated, star of December’s Indie World Showcase presentation. The video reveals that the game will be launching for Switch on 2nd June.
If you’re a regular reader of the site, you’re probably pretty clued up on this one by now – we recently shared a gallery of new, exclusive screenshots and an interview with the developer which talked about the game’s creation – but we’ll give you a quick recap just in case.
The best way to do that? A feature list, of course:
– Side-scrolling action – Intense adventure brimming with gunfights, stealth, puzzles, and platforming action. – Cyberpunk Near-future – Social networks, facial recognition, fake news, citizen credit systems. A familiar world in which technology empowers control over the people. – Order & Revolution – A story of authoritarianism—how it is born in a democracy and consumes it. Liberated men and women rise against the new world order, but at what cost? – Multiple Perspectives – A dramatic story told through unique points of view. Play as individuals locked in a clash of ideals. This is not a simple tale of good versus evil, and you must witness what transpires from many points of view to parse the truth.
Have you been keeping an eye out for Liberated’s release? Think you’ll give it a go next month? Let us know in the usual place.
It’s been said in the past that Perfect Dark protagonist Joanna Dark was modelled on historical figure Joan of Arc, but we’ve been speaking to the guys behind the game and they’ve put us right on that score – and have revealed exactly who inspired the design of the famous secret agent.
“I think that’s the thing that just sounds good,” admits David Doak – who worked on the game before leaving Rare to establish TimeSplitters studio Free Radical Design – when quizzed on the whole Joan of Arc thing. “I can’t remember whether Joanna Dark or Perfect Dark came first. I think Joanna came first, but as I recall, the Joan of Arc thing was a kind of retro-fit. Joanna Dark sounded like a nice name, and then, ‘Ooh, it sounds a bit like Joan of Arc. That’s quite good.’ As opposed to it fitting the other way around.”
Brett Jones – who did so much to shape the design of the character – explains that he was inspired by media he was consuming at the time. “We’d all been enjoying Ghost In The Shell and the Sylvester Stallone Judge Dredd film – a lot of influence from those,” he says. “We were heavily influenced by early anime stuff. Even Joanna’s costume is almost directly ripped from Ghost In The Shell. Also, the leather outfit was inspired by Mrs Peel from The Avengers, and the dragon dress actually used the dragon design from Killer Instinct.”
Joanna’s movements were provided by motion capture artist Laurie Sage, but her face was modelled on someone different. “She was completely based on Winona Ryder,” Jones admits. “I was collecting images of faces, had a massive collection of reference images and we just picked her. She had this great pixie haircut and fulfilled the look of what we wanted Joanna to look like.”
Ryder is perhaps most famous for her glittering movie career in the late ’80s and early ’90s, where she starred in hit films such as Beetlejuice, Heathers, Dracula, Reality Bites and Edward Scissorhands, but more recently she has enjoyed a resurgence thanks in part to her recurring role in the acclaimed Netflix series Stranger Things.
Perfect Dark turns 20 this month. Make sure you read our exclusive ‘making of’ feature if you haven’t already.