This code creates a read stream using the start and end values of the range. Import React from 'react' import './App.css' function App () Create a new file in the root of the server directory called app.js and add the following snippet: We can start writing code for our server. Project source repository and rename it to sample.mp4. For example, you can download one of the videos from the guide’s mp4 video file into the new assets folder, and make sure it is named sample.mp4. This will hold the video files for the server application: mkdir assetsĬopy a. Inside the server project, create a folder called assets. Nodemon automatically restarts our server when we make changes.Įxpress gives us a nice interface to handle routes.Ĭors will allow us to make cross-origin requests since our client and server will be running on different ports. Install the packages the server will need: npm install -save nodemon express cors When the command finishes, it creates a package.json file in the directory. Inside our project directory, create a folder called server: cd react-node-video-streamingįollow the prompts from npm init and use the default values it suggests. You can do this from the terminal or a GUI interface: mkdir react-node-video-streaming To get started, create a new directory that will contain both components of your application. Application Setupįor the purposes of this tutorial, both the server application and the client application will be built on your workstation. Project source code to compare your code with the final result. When following the tutorial, you can refer to the
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |