Novel transducers are needed for point of care testing (POCT) devices which aim at facile, sensitive and quick acquisition of health related information. Recent advances in optofluidics offer tremendous opportunities for biological/chemical analysis using extremely small sample volumes. This paper demonstrates nanostructured capillary tubes for surface enhanced Raman spectroscopy (SERS) analysis in a flow-through fashion. The capillary tube integrates the SERS sensor and the nanofluidic structure to synergistically offer sample delivery and analysis functions. Inside the capillary tube, inverse opal photonic crystal (IO PhC) was fabricated using the co-assembly approach to form nanoscale liquid pathways. In the nano-voids of the IO PhC, gold nanoparticles were in situ synthesized and functioned as the SERS hotspots. The advantages of the flow-through SERS sensor are multifold. The capillary effect facilities the sample delivery process, the nanofluidic channels boosts the interaction of analyte and gold nanoparticles, and the PhC structure strengthens the optical field near the SERS hotspots and results in enhanced SERS signals from analytes. As an exemplary demonstration, the sensor was used to measure creatinein spiked in artificial urine samples with detection limit of 0.9 mg/dL.