In this video, Emmanuel Henri demonstrates how to serve static files on the Node Express server for any front end to access.
- [Instructor] When in Express Base Server,…it is possible to serve static files…such as images, or any other files…you would like to have available from your back end.…So let's go ahead and make this happen.…So first of all, go inside of the Exercise Files,…and the resources, and then copy the two files.…So football and the sky.…Then go inside of crm.…And inside of the directory here…just create a public folder.…
So basically the way it works,…Express will load anything that's in the public server…so whatever files you'll put in there,…you'll be able to access it.…So for example in a browser.…So let's go ahead and paste the two images…that we have in here.…But right now, it won't work if you try it.…So let's go ahead and go inside of our browser.…Let's make sure first that our server is running.…So, yes it is.…And then go inside of our browser,…so let's go inside of Chrome.…
And do localhost/ and try to load the sky.jpeg.…And if I enter, right now it says Cannot GET /sky.jpeg.…So that's normal because we need to enter…
- Setting up a project and a server
- Setting up a database and schema
- Creating POST, GET, PUT, and DELETE endpoints
- Serving files
Skill Level Intermediate
1. Setting Up
2. Initial Server Build
3. CRUD Operations
4. Other API Options
Static files serving3m 16s
Next steps1m 1s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.