Тёмный

Deploying a backend on Vercel (APIs and Functions) 

Vercel
Подписаться 92 тыс.
Просмотров 64 тыс.
50% 1

Опубликовано:

 

3 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 82   
@cnikolov
@cnikolov 8 месяцев назад
Lee you are landing really nicely with these videos, I think the missing piece now is exploring the possibilities with edge
@lovekyordie15
@lovekyordie15 4 месяца назад
I really hope Vercel keeps investing in hosting backends! Such an underrated use case. It is such an improvement to the considerably more manual options like managing all of the infrastructure and CI/CD on AWS directly.
@jjrise
@jjrise 8 месяцев назад
would love to see some Hono examples! I have a Hono API currently deployed to Render, but all my other apps are on Vercel, so it would be extremely nice to consolidate that all to one place.
@anayeliriverasalgado8062
@anayeliriverasalgado8062 7 месяцев назад
Finally a simple way to deploy APIs.
@yaelgonzalez6114
@yaelgonzalez6114 7 месяцев назад
Deploying to Vercel looks amazing.
@dev_franqqi
@dev_franqqi 8 месяцев назад
Love this channel
@leerob
@leerob 8 месяцев назад
Let me know what else you'd like to see!
@EvHaus
@EvHaus 8 месяцев назад
I would love to be able to deploy a Docker container. Is Vercel planning on supporting that?
@thecoderabbi
@thecoderabbi 8 месяцев назад
I second this
@jellyfish1772
@jellyfish1772 8 месяцев назад
Please make on showing detailed info on how to deploy a NESTjs backend❤
@Varkoff
@Varkoff 8 месяцев назад
yeah i'd need this as well ! Deploying a complete API server (not serverless) on Vercel would be awesome
@akshayhere
@akshayhere 8 месяцев назад
Is it even possible? As they said, on Pro subscription, they limit long running services to 5 minutes.
@RAMIRREZ-2008
@RAMIRREZ-2008 7 месяцев назад
Dang that was some legit backend action right there.
@tejusr5525
@tejusr5525 8 месяцев назад
would love to see an in-depth video ✌👍
@TadeoGonzalez-oq4ym
@TadeoGonzalez-oq4ym 7 месяцев назад
Thanks Vercerl you da real MVP
@KulturanCov
@KulturanCov 4 месяца назад
More in-depth videos, please!
@aralroca
@aralroca 8 месяцев назад
Would love to see some Bun.js examples! 😊
@ignacioaristegui5197
@ignacioaristegui5197 8 месяцев назад
Would love to see how to deploy a backend with Django.
@stonekingproductions
@stonekingproductions 7 месяцев назад
I would like to see a more in depth video here. In order to use the api/ folder do you need to install Next.js?
@arkoose
@arkoose 8 месяцев назад
Nice one!, You explain it very good.
@JosueHernandez-qj4ty
@JosueHernandez-qj4ty 7 месяцев назад
I second that, great video!
@codemedic
@codemedic 4 месяца назад
Pls make a more descriptive step-by-step tutorial 🙏🙏
@IvanRandomDude
@IvanRandomDude 8 месяцев назад
Does anyone know how this compares to Cloudflare Workers in terms of performance, latency, pricing etc?
@cayt3r
@cayt3r 8 месяцев назад
It's always hard to compete with Cloudflare on the pricing front. They own the network which can reduce the egress fee significantly. Vercel is mostly wrapping around the providers like AWS, Cloudflare to provide better DX. In any case, if you are using Vercel, you should think of it as outsourcing your DevOps/Platform team to them to provide a modernised DX that builds on top of serverless technology. It's essentially a DevOps or Platform Engineering as a service, and the price definitely will be higher than Cloudflare, it's still business profit in the picture despite the DX improvement.
@oeuvars
@oeuvars 8 месяцев назад
please show us a guide on how to deploy express with typescript on vercel
@neociber24
@neociber24 8 месяцев назад
Keep in mind Vercel is for serverless
@leerob
@leerob 8 месяцев назад
Love this suggestion, can do.
@oeuvars
@oeuvars 8 месяцев назад
@@leerob Thank you!
@fire17102
@fire17102 8 месяцев назад
​@@oeuvars hey yo, hope it's ok to ask, what's the meaning of the symbol in your pic? Thx and all the best
@oeuvars
@oeuvars 8 месяцев назад
@@fire17102 Hindu swastika, i understand the logic behind your question lol. And thank you.
@atmmoreirarj
@atmmoreirarj 22 дня назад
I'm having a problem receiving a 404 error, when I run vercel dev. May someone can help me?
@shivanshpatel4072
@shivanshpatel4072 8 месяцев назад
Does this work for Nestjs as well ?
@mystickago
@mystickago 8 месяцев назад
yes more the better, your explainations are S tair
@raihan8097
@raihan8097 8 месяцев назад
Can i host strapi too?
@gappalchemist
@gappalchemist 8 месяцев назад
Lee Rob the Goat 👌
@mzafarr
@mzafarr 8 месяцев назад
Can we deploy Nest.js on vercel?
@kennysus6174
@kennysus6174 2 месяца назад
Hey whenever i host any website on vercel, the css just doesnt not load. all of the other things work fine...
@miguelemmara5046
@miguelemmara5046 8 месяцев назад
is there a way to make it faster? less than 30ms per request?
@anuragdhote8902
@anuragdhote8902 8 месяцев назад
does this work for Web Sockets as well?
@ujjawal_
@ujjawal_ 8 месяцев назад
no, I deployed my backend which is in express and socket io on vercel it was not working. After searching got to know it's not supported on vercel. So I looked for other alternatives.
@aldoyh
@aldoyh 8 месяцев назад
True.. all backend frameworks.. Except PHP!!
@twitchizle
@twitchizle 8 месяцев назад
they support php afaik
@aldoyh
@aldoyh 8 месяцев назад
@@twitchizle I've reached their support and they replied that's possible if you convert them to JS using some tool! Oh C'mon!
@twitchizle
@twitchizle 8 месяцев назад
@@aldoyh there should be php runtime support related text in the docs. Im 100% sure i saw it.
@aldoyh
@aldoyh 8 месяцев назад
Please dear@@twitchizle .. Amaze me.
@jonathangamble
@jonathangamble 8 месяцев назад
Please fix vercel/og outside of nextjs!
@fire17102
@fire17102 8 месяцев назад
Hey guys, how come Python is not a Vercel Framework? Don't get it... Why can't you run my flask?
@aldrickdev
@aldrickdev 8 месяцев назад
Wil this eventually work for other languages, or is this going to stay as a tool for Javascript developers?
@VercelHQ
@VercelHQ 8 месяцев назад
We support Python and Go as well.
@BlackishGreen
@BlackishGreen 8 месяцев назад
can i deploy a discord.js backend app based on websocket too?
@ekchills6948
@ekchills6948 8 месяцев назад
please we need detailed info
@dmarksbarber
@dmarksbarber 8 месяцев назад
I tried deploying Hono TypeScript with path aliases. Ran into issues. Tech support reached out to engineering but they never got back. Happy to share the ticket number.
@leerob
@leerob 8 месяцев назад
Thank you, yeah would love to dig in and also get a better Hono example up!
@Axel.Blazer
@Axel.Blazer 21 день назад
i wanted to deploy a backend n frontend project on vercel..using express n node at backedn and ejs as view engine..idk how but im unable to see anything when deployed..my directory schema is: index.js /views => all ejs files /public => /js /img /css can someone help on what im doing wrong or is there another way to host this type of structure im not using any db just performing CRUD on a local file in the repo itself ill paste index.js in next comment..any help is appreciated.. =))
@Axel.Blazer
@Axel.Blazer 21 день назад
const express = require('express'); const app = express(); const session = require('express-session'); const path = require('path'); const fs = require('fs'); const multer = require('multer'); require('dotenv').config(); // Set up EJS as the view engine app.set("views", path.join(__dirname, "views")); app.set("view engine", "ejs"); app.use(express.json()); app.use(express.urlencoded({ extended: true })); app.use(express.static(path.join(__dirname, "public"))); // Configure session middleware app.use(session({ secret: process.env.SESSION_SECRET, resave: false, saveUninitialized: true, cookie: { secure: false, maxAge: 24 * 60 * 60 * 1000 } // Cookie expires in 24 hours })); // Middleware to check if the user is logged in function checkLoggedIn(req, res, next) { if (!req.session.email) { return res.redirect('/login'); } next(); } // Set up multer for image uploads const storage = multer.memoryStorage(); const upload = multer({ storage: storage }); // Route to render index.ejs app.get("/", function (req, res) { const email = req.session.email; let name = null; if (email) { const users = JSON.parse(fs.readFileSync('users.json', 'utf8')); name = users[email]?.name || email.split('@')[0]; } let listings = JSON.parse(fs.readFileSync('listings.json', 'utf8')); if (email) { listings = Object.entries(listings) .filter(([sellerEmail, sellerListings]) => sellerEmail !== email) .reduce((acc, [sellerEmail, sellerListings]) => { const filteredListings = sellerListings.filter(listing => listing.buyerEmail !== email); if (filteredListings.length) { acc[sellerEmail] = filteredListings; } return acc; }, {}); } let allListings = Object.values(listings).flat(); const marqueeListings = allListings.splice(0, 25); const books = allListings.filter(listing => listing.category === 'books'); const notes = allListings.filter(listing => listing.category === 'notes'); const instruments = allListings.filter(listing => listing.category === 'instruments'); const utilities = allListings.filter(listing => listing.category === 'other utilities'); res.render("index", { name, marqueeListings, books, notes, instruments, utilities, }); }); // Route to render login.ejs app.get("/login", function (req, res) { res.render("login", { error: null }); }); // Route to handle login logic app.post("/login", function (req, res) { const { email, password } = req.body; let users = JSON.parse(fs.readFileSync('users.json')); if (users[email] && users[email].password === password) { req.session.email = email; return res.redirect('/profile'); } else { return res.render('login', { error: "Invalid email or password" }); } }); // Route to render signup.ejs app.get("/signup", function (req, res) { res.render("signup", { error: null }); }); // Route to handle signup logic app.post("/signup", function (req, res) { try { const { name, email, city, institution, password } = req.body; if (!name || !email || !city || !institution || !password) { return res.render('signup', { error: "All fields are required" }); } let users = JSON.parse(fs.readFileSync('users.json', 'utf8')); if (users[email]) { return res.render('signup', { error: "Email is already registered" }); } if (password.length < 8) { return res.render('signup', { error: "Password must be at least 8 characters long" }); } users[email] = { name, city, institution, password }; fs.writeFileSync('users.json', JSON.stringify(users, null, 2)); req.session.email = email; res.redirect('/profile'); } catch (err) { console.error("Error during signup:", err); res.render('signup', { error: "An error occurred during signup. Please try again." }); } }); // Route to render profile.ejs (Requires login) app.get("/profile", checkLoggedIn, function (req, res) { const email = req.session.email; const users = JSON.parse(fs.readFileSync('users.json', 'utf8')); const name = users[email]?.name || email.split('@')[0]; let listings = []; let orders = []; try { const data = JSON.parse(fs.readFileSync('listings.json', 'utf8')); if (data[email]) { listings = data[email].map(listing => ({ ...listing, image: `data:image/jpeg;base64,${listing.image}`, sellerEmail: email // Include the seller's email })); } for (let sellerEmail in data) { const userOrders = data[sellerEmail].filter(listing => listing.buyerEmail === email); orders.push(...userOrders.map(order => ({ ...order, image: `data:image/jpeg;base64,${order.image}`, sellerEmail // Include the seller's email }))); } res.render("profile", { email, name, listings, orders }); } catch (err) { console.error("Error reading listings.json:", err); res.render("profile", { email, name, listings, orders }); } }); // Route to sign out app.post("/signout", function (req, res) { req.session.destroy(err => { if (err) { console.error("Error during signout:", err); } res.redirect('/'); }); }); // Route to render list.ejs (Requires login) app.get("/list", checkLoggedIn, function (req, res) { const email = req.session.email; res.render("list", { email }); }); // Route to handle product listing logic (Requires login) app.post("/list", checkLoggedIn, upload.single('productImage'), function (req, res) { const { productName, productTitle, productPrice, productCategory, buyerEmail } = req.body; const productImage = req.file.buffer.toString('base64'); let listings = JSON.parse(fs.readFileSync('listings.json')); const listing = { id: Math.random().toString(36).substr(2, 32), title: productTitle, description: productName, price: productPrice, category: productCategory, image: productImage, buyerEmail: buyerEmail || null }; if (!listings[req.session.email]) { listings[req.session.email] = []; } listings[req.session.email].push(listing); fs.writeFileSync('listings.json', JSON.stringify(listings, null, 2)); res.redirect('/profile'); }); // Start the server app.listen(3000, () => { console.log("Server running on localhost:3000"); });
@BhideSvelte
@BhideSvelte 8 месяцев назад
now can we host pocketbase on vercel ?
@nicov99
@nicov99 8 месяцев назад
does it work with a .NET api?
@b_two
@b_two 8 месяцев назад
can we run deno on vercel?
@VercelHQ
@VercelHQ 8 месяцев назад
github.com/vercel-community/deno
@0xtz_
@0xtz_ 8 месяцев назад
I can't change the run command ? bc I have a project with front and server and I need to run the vite and then node ./server/index.js
@nikitaistomin3588
@nikitaistomin3588 8 месяцев назад
Have you tried using "concurrently" pkg?
@0xtz_
@0xtz_ 8 месяцев назад
@@nikitaistomin3588 yes but didn't work well hhhhh or 8 did something wrong
@guillermobarboza5903
@guillermobarboza5903 8 месяцев назад
are this lambdas?
@lambertotamayo4320
@lambertotamayo4320 8 месяцев назад
Its like firebase function.
@mettle_x
@mettle_x 8 месяцев назад
I found Vercel serverless functions very flaky. It started receiving empty JSON body from Discord webhook interactions suddenly without prior notice or any code change from my end. The fault might not be from the Discord side since I just switched to a VPS and it worked fine there.
@aberba
@aberba 8 месяцев назад
Do you build with babel?
@sleekism
@sleekism 8 месяцев назад
Deploying to a lot of modern clouds have this issue. Stuff just stops working without any stimulus
@mettle_x
@mettle_x 8 месяцев назад
@@aberba No, I use the default TypeScript setup from Next.js
@geralddd.g
@geralddd.g 8 месяцев назад
Needed
@ColdestElite_Vibe
@ColdestElite_Vibe 8 месяцев назад
thanks
@HardikAjani
@HardikAjani 8 месяцев назад
Lovely
@loveboat
@loveboat 8 месяцев назад
Understood about 1% of this.
@thehostingchannel
@thehostingchannel 8 месяцев назад
Make it so you get unlimited bandwith with pro plan
@cnikolov
@cnikolov 8 месяцев назад
The easiest way to turn your apis to lambdas
@george_davituri
@george_davituri 8 месяцев назад
🤟🏻🏂
@simonmbewe6324
@simonmbewe6324 6 месяцев назад
time westing .next time just go direct to a point
Далее
10 common mistakes with the Next.js App Router
20:37
Просмотров 217 тыс.
Heroku Is Dead, Here's What I Recommend
11:59
Просмотров 262 тыс.
Why you SHOULD deploy to the edge
12:06
Просмотров 54 тыс.
Vercel v0 vs Claude Sonnet - Product Hunt
8:09
Просмотров 3,9 тыс.
Build anything with v0 (3D games, interactive apps)
9:05
Should you use a VPS instead of Vercel, Netlify & co?
13:14
Is "edge" computing really faster?
8:14
Просмотров 591 тыс.
The BEST Tool to Deploy Your Apps (Stop using Vercel)
10:07
Vercel Gave Up On Edge
17:50
Просмотров 102 тыс.