Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@expo/dev-server

Package Overview
Dependencies
Maintainers
22
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expo/dev-server

Development servers for starting React Native projects

  • 0.5.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
22
Created

What is @expo/dev-server?

@expo/dev-server is a development server for Expo projects. It provides a local server for serving your Expo app, enabling features like live reloading, error reporting, and debugging tools. This package is essential for a smooth development experience when working with Expo-based React Native applications.

What are @expo/dev-server's main functionalities?

Start Development Server

This feature allows you to start a development server for your Expo project. The server will serve your app and provide live reloading and other development tools.

const { startDevServerAsync } = require('@expo/dev-server');

async function startServer() {
  const server = await startDevServerAsync({
    projectRoot: __dirname,
    port: 19000
  });
  console.log(`Server is running on port ${server.port}`);
}

startServer();

Handle Errors

This feature demonstrates how to handle errors when starting the development server. It ensures that any issues encountered during server startup are properly logged.

const { startDevServerAsync } = require('@expo/dev-server');

async function startServer() {
  try {
    const server = await startDevServerAsync({
      projectRoot: __dirname,
      port: 19000
    });
    console.log(`Server is running on port ${server.port}`);
  } catch (error) {
    console.error('Failed to start server:', error);
  }
}

startServer();

Custom Middleware

This feature allows you to add custom middleware to the development server. In this example, a simple middleware logs the request URL for each incoming request.

const { startDevServerAsync } = require('@expo/dev-server');
const express = require('express');

async function startServer() {
  const app = express();
  app.use((req, res, next) => {
    console.log('Request URL:', req.url);
    next();
  });

  const server = await startDevServerAsync({
    projectRoot: __dirname,
    port: 19000,
    middleware: app
  });
  console.log(`Server is running on port ${server.port}`);
}

startServer();

Other packages similar to @expo/dev-server

Keywords

FAQs

Package last updated on 21 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc